better TREATMENT logging
This commit is contained in:
parent
653a98fd5b
commit
8f9d0269c1
2 changed files with 8 additions and 12 deletions
|
@ -244,17 +244,8 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
|
||||||
Treatment treatment = Treatment.createFromJson(json);
|
Treatment treatment = Treatment.createFromJson(json);
|
||||||
if (treatment != null)
|
if (treatment != null)
|
||||||
createOrUpdate(treatment);
|
createOrUpdate(treatment);
|
||||||
} catch (JSONException e) {
|
else
|
||||||
log.error("Unhandled exception", e);
|
log.error("Date is null: " + treatment.toString());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createFoodFromJsonIfNotExists(JSONArray array) {
|
|
||||||
try {
|
|
||||||
for (int n = 0; n < array.length(); n++) {
|
|
||||||
JSONObject json = array.getJSONObject(n);
|
|
||||||
createTreatmentFromJsonIfNotExists(json);
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
@ -340,6 +331,8 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
|
||||||
scheduleTreatmentChange(treatment);
|
scheduleTreatmentChange(treatment);
|
||||||
return new UpdateReturn(true, true);
|
return new UpdateReturn(true, true);
|
||||||
}
|
}
|
||||||
|
if (L.isEnabled(L.DATATREATMENTS))
|
||||||
|
log.debug("Equal record by date from: " + Source.getString(treatment.source) + " " + old.toString());
|
||||||
return new UpdateReturn(true, false);
|
return new UpdateReturn(true, false);
|
||||||
}
|
}
|
||||||
// find by NS _id
|
// find by NS _id
|
||||||
|
@ -361,6 +354,9 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
|
||||||
scheduleTreatmentChange(treatment);
|
scheduleTreatmentChange(treatment);
|
||||||
return new UpdateReturn(true, true);
|
return new UpdateReturn(true, true);
|
||||||
}
|
}
|
||||||
|
if (L.isEnabled(L.DATATREATMENTS))
|
||||||
|
log.debug("Equal record by _id from: " + Source.getString(treatment.source) + " " + old.toString());
|
||||||
|
return new UpdateReturn(true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDao().create(treatment);
|
getDao().create(treatment);
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class DataService extends IntentService {
|
||||||
MainApp.getDbHelper().deleteProfileSwitchById(_id);
|
MainApp.getDbHelper().deleteProfileSwitchById(_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleTreatmentFromNS(JSONObject json, Intent intent) throws JSONException {
|
private void handleTreatmentFromNS(JSONObject json, Intent intent) {
|
||||||
// new DB model
|
// new DB model
|
||||||
int mode = Intents.ACTION_NEW_TREATMENT.equals(intent.getAction()) ? EventNsTreatment.ADD : EventNsTreatment.UPDATE;
|
int mode = Intents.ACTION_NEW_TREATMENT.equals(intent.getAction()) ? EventNsTreatment.ADD : EventNsTreatment.UPDATE;
|
||||||
double insulin = JsonHelper.safeGetDouble(json, "insulin");
|
double insulin = JsonHelper.safeGetDouble(json, "insulin");
|
||||||
|
|
Loading…
Reference in a new issue