better detect meal bolus
This commit is contained in:
parent
68a127d804
commit
aa24a592fa
1 changed files with 20 additions and 4 deletions
|
@ -480,8 +480,16 @@ public class DataService extends IntentService {
|
|||
treatment.created_at = new Date(trJson.getLong("mills"));
|
||||
if (trJson.has("eventType")) {
|
||||
treatment.mealBolus = true;
|
||||
if (trJson.get("eventType").equals("Correction Bolus")) treatment.mealBolus = false;
|
||||
if (trJson.get("eventType").equals("Bolus Wizard") && treatment.carbs <= 0)
|
||||
if (trJson.get("eventType").equals("Correction Bolus"))
|
||||
treatment.mealBolus = false;
|
||||
double carbs = treatment.carbs;
|
||||
if (trJson.has("boluscalc")) {
|
||||
JSONObject boluscalc = trJson.getJSONObject("boluscalc");
|
||||
if (boluscalc.has("carbs")) {
|
||||
carbs = Math.max(boluscalc.getDouble("carbs"), carbs);
|
||||
}
|
||||
}
|
||||
if (carbs <= 0)
|
||||
treatment.mealBolus = false;
|
||||
}
|
||||
treatment.setTimeIndex(treatment.getTimeIndex());
|
||||
|
@ -532,8 +540,16 @@ public class DataService extends IntentService {
|
|||
treatment.created_at = new Date(trJson.getLong("mills"));
|
||||
if (trJson.has("eventType")) {
|
||||
treatment.mealBolus = true;
|
||||
if (trJson.get("eventType").equals("Correction Bolus")) treatment.mealBolus = false;
|
||||
if (trJson.get("eventType").equals("Bolus Wizard") && treatment.carbs <= 0)
|
||||
if (trJson.get("eventType").equals("Correction Bolus"))
|
||||
treatment.mealBolus = false;
|
||||
double carbs = treatment.carbs;
|
||||
if (trJson.has("boluscalc")) {
|
||||
JSONObject boluscalc = trJson.getJSONObject("boluscalc");
|
||||
if (boluscalc.has("carbs")) {
|
||||
carbs = Math.max(boluscalc.getDouble("carbs"), carbs);
|
||||
}
|
||||
}
|
||||
if (carbs <= 0)
|
||||
treatment.mealBolus = false;
|
||||
}
|
||||
treatment.setTimeIndex(treatment.getTimeIndex());
|
||||
|
|
Loading…
Reference in a new issue