glucoseReading fix

This commit is contained in:
Milos Kozak 2016-06-11 22:46:47 +02:00
parent 54a25aa1ed
commit 74dcbb1864
2 changed files with 5 additions and 6 deletions

View file

@ -192,10 +192,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
double avg;
if (bgReadings.size() > 3) {
BgReading now = bgReadings.get(sizeRecords - 1);
BgReading last = bgReadings.get(sizeRecords - 2);
BgReading last1 = bgReadings.get(sizeRecords - 3);
BgReading last2 = bgReadings.get(sizeRecords - 4);
BgReading now = bgReadings.get(sizeRecords - 4);
BgReading last = bgReadings.get(sizeRecords - 3);
BgReading last1 = bgReadings.get(sizeRecords - 2);
BgReading last2 = bgReadings.get(sizeRecords - 1);
if (last2.value > 30) {
minutes = 3 * 5;
change = now.value - last2.value;
@ -212,7 +212,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
avg = change / minutes * 5;
result.glucose = now.value;
result.delta = change;
result.delta = now.value - last.value;
result.avgdelta = avg;
}
} catch (SQLException e) {

View file

@ -36,7 +36,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="@+id/openapsma_lastrun"
android:layout_marginLeft="10dp" />
</LinearLayout>