divisions with doubles to not do whole minute jumps

This commit is contained in:
AdrianLxM 2016-11-12 13:10:19 +01:00
parent 68acc3aca3
commit 12fc454fe1

View file

@ -291,7 +291,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return null; return null;
} }
long minutes = 5; double minutes = 5;
double change; double change;
double avg; double avg;
@ -301,13 +301,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
BgReading last1 = bgReadings.get(sizeRecords - 2); BgReading last1 = bgReadings.get(sizeRecords - 2);
BgReading last2 = bgReadings.get(sizeRecords - 1); BgReading last2 = bgReadings.get(sizeRecords - 1);
if (last2.value > 30) { if (last2.value > 30) {
minutes = (now.timeIndex - last2.timeIndex)/(60*1000); minutes = (now.timeIndex - last2.timeIndex)/(60d*1000);
change = now.value - last2.value; change = now.value - last2.value;
} else if (last1.value > 30) { } else if (last1.value > 30) {
minutes = (now.timeIndex - last1.timeIndex)/(60*1000);; minutes = (now.timeIndex - last1.timeIndex)/(60d*1000);;
change = now.value - last1.value; change = now.value - last1.value;
} else if (last.value > 30) { } else if (last.value > 30) {
minutes = (now.timeIndex - last.timeIndex)/(60*1000); minutes = (now.timeIndex - last.timeIndex)/(60d*1000);
change = now.value - last.value; change = now.value - last.value;
} else { } else {
change = 0; change = 0;