commit
fd3e32ddfa
1 changed files with 5 additions and 5 deletions
|
@ -291,7 +291,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int 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 = 3 * 5;
|
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 = 2 * 5;
|
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 = 5;
|
minutes = (now.timeIndex - last.timeIndex)/(60d*1000);
|
||||||
change = now.value - last.value;
|
change = now.value - last.value;
|
||||||
} else {
|
} else {
|
||||||
change = 0;
|
change = 0;
|
||||||
|
@ -316,7 +316,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
avg = change / minutes * 5;
|
avg = change / minutes * 5;
|
||||||
|
|
||||||
result.glucose = now.value;
|
result.glucose = now.value;
|
||||||
result.delta = now.value - last.value;
|
result.delta = (now.value - last.value)*5*60*1000/(now.getTimeIndex() - last.getTimeIndex());
|
||||||
result.avgdelta = avg;
|
result.avgdelta = avg;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
Loading…
Reference in a new issue