fix parsin TT - missing duration

This commit is contained in:
Milos Kozak 2019-04-03 16:43:56 +02:00
parent 64c9196a5c
commit ec93045d84

View file

@ -419,7 +419,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
/* /*
* Return last BgReading from database or null if db is empty * Return last BgReading from database or null if db is empty
*/ */
@Nullable @NullablecreateTemptargetFromJsonIfNotExists
public static BgReading lastBg() { public static BgReading lastBg() {
List<BgReading> bgList = IobCobCalculatorPlugin.getPlugin().getBgReadings(); List<BgReading> bgList = IobCobCalculatorPlugin.getPlugin().getBgReadings();
@ -726,7 +726,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
String units = JsonHelper.safeGetString(trJson, "units", Constants.MGDL); String units = JsonHelper.safeGetString(trJson, "units", Constants.MGDL);
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(trJson.getLong("mills")) .date(trJson.getLong("mills"))
.duration(trJson.getInt("duration")) .duration(JsonHelper.safeGetInt(trJson, "duration"))
.low(Profile.toMgdl(trJson.getDouble("targetBottom"), units)) .low(Profile.toMgdl(trJson.getDouble("targetBottom"), units))
.high(Profile.toMgdl(trJson.getDouble("targetTop"), units)) .high(Profile.toMgdl(trJson.getDouble("targetTop"), units))
.reason(JsonHelper.safeGetString(trJson, "reason", "")) .reason(JsonHelper.safeGetString(trJson, "reason", ""))