Fix missingDays after loadLastRun
This commit is contained in:
parent
690b851511
commit
9508730c35
1 changed files with 13 additions and 5 deletions
|
@ -310,11 +310,16 @@ class AutotunePlugin @Inject constructor(
|
||||||
json.put("pumpProfileName", pumpProfile.profilename)
|
json.put("pumpProfileName", pumpProfile.profilename)
|
||||||
json.put("pumpPeak", pumpProfile.peak)
|
json.put("pumpPeak", pumpProfile.peak)
|
||||||
json.put("pumpDia", pumpProfile.dia)
|
json.put("pumpDia", pumpProfile.dia)
|
||||||
json.put("tunedProfile", tunedProfile?.profile?.toPureNsJson(dateUtil))
|
tunedProfile?.let { atProfile ->
|
||||||
json.put("tunedCircadianProfile", tunedProfile?.circadianProfile?.toPureNsJson(dateUtil))
|
json.put("tunedProfile", atProfile.profile.toPureNsJson(dateUtil))
|
||||||
json.put("tunedProfileName", tunedProfile?.profilename)
|
json.put("tunedCircadianProfile", atProfile.circadianProfile.toPureNsJson(dateUtil))
|
||||||
json.put("tunedPeak", tunedProfile?.peak)
|
json.put("tunedProfileName", atProfile.profilename)
|
||||||
json.put("tunedDia", tunedProfile?.dia)
|
json.put("tunedPeak", atProfile.peak)
|
||||||
|
json.put("tunedDia", atProfile.dia)
|
||||||
|
for (i in 0..23) {
|
||||||
|
json.put("missingDays_$i", atProfile.basalUntuned[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
json.put("result", result)
|
json.put("result", result)
|
||||||
json.put("updateButtonVisibility", updateButtonVisibility)
|
json.put("updateButtonVisibility", updateButtonVisibility)
|
||||||
sp.putString(R.string.key_autotune_last_run, json.toString())
|
sp.putString(R.string.key_autotune_last_run, json.toString())
|
||||||
|
@ -345,6 +350,9 @@ class AutotunePlugin @Inject constructor(
|
||||||
tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile ->
|
tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile ->
|
||||||
atProfile.profilename = tunedProfileName
|
atProfile.profilename = tunedProfileName
|
||||||
atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned)
|
atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned)
|
||||||
|
for (i in 0..23) {
|
||||||
|
atProfile.basalUntuned[i] = JsonHelper.safeGetInt(json,"missingDays_$i")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result = JsonHelper.safeGetString(json, "result", "")
|
result = JsonHelper.safeGetString(json, "result", "")
|
||||||
updateButtonVisibility = JsonHelper.safeGetInt(json, "updateButtonVisibility")
|
updateButtonVisibility = JsonHelper.safeGetInt(json, "updateButtonVisibility")
|
||||||
|
|
Loading…
Reference in a new issue