Skip to content

Commit

Permalink
[persistence] Fix varianceSince and deviationSince (#2036)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hilbush <mark@hilbush.com>
  • Loading branch information
mhilbush authored and cweitkamp committed Jan 10, 2021
1 parent 1cadfcf commit 321c443
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ public static DecimalType varianceSince(Item item, ZonedDateTime timestamp, Stri
BigDecimal average = averageSince.toBigDecimal(), sum = BigDecimal.ZERO;
int count = 0;

it = result.iterator();
while (it.hasNext()) {
HistoricItem historicItem = it.next();
DecimalType value = historicItem.getState().as(DecimalType.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ public void testMinimumSwitchSince() {
assertEquals(OnOffType.ON, historicItem.getState());
}

@Test
public void testVarianceSince() {
numberItem.setState(new DecimalType(3025));

Expand All @@ -262,6 +263,7 @@ public void testVarianceSince() {
assertNull(variance);
}

@Test
public void testDeviationSince() {
numberItem.setState(new DecimalType(3025));

Expand Down

0 comments on commit 321c443

Please sign in to comment.