[persistence] Fix varianceSince and deviationSince (#2036)
Signed-off-by: Mark Hilbush <mark@hilbush.com>pull/2180/head
parent
1cadfcfb9f
commit
321c443aa3
|
@ -397,6 +397,7 @@ public class PersistenceExtensions {
|
||||||
BigDecimal average = averageSince.toBigDecimal(), sum = BigDecimal.ZERO;
|
BigDecimal average = averageSince.toBigDecimal(), sum = BigDecimal.ZERO;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
it = result.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
HistoricItem historicItem = it.next();
|
HistoricItem historicItem = it.next();
|
||||||
DecimalType value = historicItem.getState().as(DecimalType.class);
|
DecimalType value = historicItem.getState().as(DecimalType.class);
|
||||||
|
|
|
@ -236,6 +236,7 @@ public class PersistenceExtensionsTest {
|
||||||
assertEquals(OnOffType.ON, historicItem.getState());
|
assertEquals(OnOffType.ON, historicItem.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testVarianceSince() {
|
public void testVarianceSince() {
|
||||||
numberItem.setState(new DecimalType(3025));
|
numberItem.setState(new DecimalType(3025));
|
||||||
|
|
||||||
|
@ -262,6 +263,7 @@ public class PersistenceExtensionsTest {
|
||||||
assertNull(variance);
|
assertNull(variance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDeviationSince() {
|
public void testDeviationSince() {
|
||||||
numberItem.setState(new DecimalType(3025));
|
numberItem.setState(new DecimalType(3025));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue