Merge pull request #85 from AdrianLxM/wear-nullprofile-fix
limit readings to values above 38
This commit is contained in:
commit
1c719bbd9a
2 changed files with 7 additions and 4 deletions
|
@ -22,7 +22,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
||||||
}
|
}
|
||||||
|
|
||||||
var bg = glucose_status.glucose;
|
var bg = glucose_status.glucose;
|
||||||
if (bg < 30) { //Dexcom is in ??? mode or calibrating, do nothing. Asked @benwest for raw data in iter_glucose
|
if (bg < 38) { //Dexcom is in ??? mode or calibrating, do nothing. Asked @benwest for raw data in iter_glucose
|
||||||
rT.error = "CGM is calibrating or in ??? state";
|
rT.error = "CGM is calibrating or in ??? state";
|
||||||
return rT;
|
return rT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
QueryBuilder<BgReading, Long> queryBuilder = daoBgReadings.queryBuilder();
|
QueryBuilder<BgReading, Long> queryBuilder = daoBgReadings.queryBuilder();
|
||||||
queryBuilder.orderBy("timeIndex", false);
|
queryBuilder.orderBy("timeIndex", false);
|
||||||
queryBuilder.limit(1L);
|
queryBuilder.limit(1L);
|
||||||
|
queryBuilder.where().gt("value", 38);
|
||||||
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
||||||
bgList = daoBgReadings.query(preparedQuery);
|
bgList = daoBgReadings.query(preparedQuery);
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
queryBuilder.orderBy("timeIndex", true);
|
queryBuilder.orderBy("timeIndex", true);
|
||||||
Where where = queryBuilder.where();
|
Where where = queryBuilder.where();
|
||||||
where.ge("timeIndex", mills);
|
where.ge("timeIndex", mills);
|
||||||
|
queryBuilder.where().gt("value", 38);
|
||||||
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
||||||
bgReadings = daoBgreadings.query(preparedQuery);
|
bgReadings = daoBgreadings.query(preparedQuery);
|
||||||
return bgReadings;
|
return bgReadings;
|
||||||
|
@ -281,6 +283,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
List<BgReading> bgReadings;
|
List<BgReading> bgReadings;
|
||||||
QueryBuilder<BgReading, Long> queryBuilder = daoBgreadings.queryBuilder();
|
QueryBuilder<BgReading, Long> queryBuilder = daoBgreadings.queryBuilder();
|
||||||
queryBuilder.orderBy("timeIndex", false);
|
queryBuilder.orderBy("timeIndex", false);
|
||||||
|
queryBuilder.where().gt("value", 38);
|
||||||
queryBuilder.limit(4l);
|
queryBuilder.limit(4l);
|
||||||
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
||||||
bgReadings = daoBgreadings.query(preparedQuery);
|
bgReadings = daoBgreadings.query(preparedQuery);
|
||||||
|
@ -300,13 +303,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
BgReading last = bgReadings.get(sizeRecords - 3);
|
BgReading last = bgReadings.get(sizeRecords - 3);
|
||||||
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 > 38) {
|
||||||
minutes = (now.timeIndex - last2.timeIndex)/(60d*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 > 38) {
|
||||||
minutes = (now.timeIndex - last1.timeIndex)/(60d*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 > 38) {
|
||||||
minutes = (now.timeIndex - last.timeIndex)/(60d*1000);
|
minutes = (now.timeIndex - last.timeIndex)/(60d*1000);
|
||||||
change = now.value - last.value;
|
change = now.value - last.value;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue