Fixes Measurement class to gauge-off correctly
This commit is contained in:
@@ -107,7 +107,7 @@ public class Measurement {
|
||||
return dailyMin;
|
||||
}
|
||||
|
||||
public static boolean isToday(ZonedDateTime inpZDT){
|
||||
private static boolean isToday(ZonedDateTime inpZDT){
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
if (now.toLocalDate().equals(inpZDT.toLocalDate())){
|
||||
return true;
|
||||
@@ -115,7 +115,7 @@ public class Measurement {
|
||||
return false;
|
||||
};
|
||||
|
||||
public void update(double value)
|
||||
void update(double value)
|
||||
{
|
||||
long currentTimestamp = ZonedDateTime.now().toEpochSecond();
|
||||
lastValue = currentValue;
|
||||
@@ -138,14 +138,13 @@ public class Measurement {
|
||||
}
|
||||
}
|
||||
|
||||
public void endOfDay(){
|
||||
void endOfDay(){
|
||||
if (storeInDatabase){
|
||||
db.newDailyTotal(this);
|
||||
}
|
||||
for(int i = 28; i >= 0; i--){
|
||||
totalHistory[i] = totalHistory[i+1];
|
||||
averageHistory[i] = averageHistory[i+1];
|
||||
}
|
||||
|
||||
System.arraycopy(totalHistory, 0, totalHistory, 1, totalHistory.length-1);
|
||||
System.arraycopy(averageHistory, 0, averageHistory, 1, averageHistory.length-1);
|
||||
|
||||
totalHistory[0] = total;
|
||||
averageHistory[0] = average;
|
||||
@@ -154,8 +153,6 @@ public class Measurement {
|
||||
average = 0;
|
||||
dailyMax = Double.MIN_VALUE;
|
||||
dailyMin = Double.MAX_VALUE;
|
||||
numMeasurements = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user