Skip to content

Commit

Permalink
[linky] Filter on dates when building the report requested from conso…
Browse files Browse the repository at this point in the history
…le (openhab#17824)

Related to openhab#17070

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo authored and matchews committed Dec 16, 2024
1 parent a819188 commit 201e896
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ private List<String> buildReport(LocalDate startDay, LocalDate endDay, @Nullable
: (days.datas.size() <= days.periodes.size() ? days.datas.size() : days.periodes.size());
for (int i = 0; i < size; i++) {
double consumption = days.datas.get(i);
LocalDate day = days.periodes.get(i).dateDebut.toLocalDate();
// Filter data in case it contains data from dates outside the requested period
if (day.isBefore(startDay) || day.isAfter(endDay)) {
continue;
}
String line = days.periodes.get(i).dateDebut.format(DateTimeFormatter.ISO_LOCAL_DATE) + separator;
if (consumption >= 0) {
line += String.valueOf(consumption);
Expand Down

0 comments on commit 201e896

Please sign in to comment.