[persistence] Fix varianceSince and deviationSince (#2036)

Signed-off-by: Mark Hilbush <mark@hilbush.com>
pull/2180/head
Mark Hilbush 2020-12-30 16:55:41 -05:00 committed by Christoph Weitkamp
parent 1cadfcfb9f
commit 321c443aa3
No known key found for this signature in database
GPG Key ID: E60BC5062C9F0695
2 changed files with 3 additions and 0 deletions

View File

@ -397,6 +397,7 @@ public class PersistenceExtensions {
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);

View File

@ -236,6 +236,7 @@ public class PersistenceExtensionsTest {
assertEquals(OnOffType.ON, historicItem.getState());
}
@Test
public void testVarianceSince() {
numberItem.setState(new DecimalType(3025));
@ -262,6 +263,7 @@ public class PersistenceExtensionsTest {
assertNull(variance);
}
@Test
public void testDeviationSince() {
numberItem.setState(new DecimalType(3025));