objectives fix

This commit is contained in:
Milos Kozak 2019-09-27 18:03:58 +02:00
parent 300eecf27d
commit f118efa6ed
3 changed files with 8 additions and 4 deletions

View file

@ -64,7 +64,7 @@ object ObjectivesPlugin : PluginBase(PluginDescription()
private fun doConvertSP(number: Int, name: String) {
if (!SP.contains("Objectives_" + name + "_started")) {
SP.putLong("Objectives_" + name + "_started", SP.getLong("Objectives" + number + "accomplished", 0L))
SP.putLong("Objectives_" + name + "_started", SP.getLong("Objectives" + number + "started", 0L))
SP.putLong("Objectives_" + name + "_accomplished", SP.getLong("Objectives" + number + "accomplished", 0L))
}
// TODO: we can remove Objectives1accomplished sometimes later

View file

@ -36,6 +36,10 @@ public abstract class Objective {
this.gate = gate;
startedOn = SP.getLong("Objectives_" + spName + "_started", 0L);
accomplishedOn = SP.getLong("Objectives_" + spName + "_accomplished", 0L);
if ((accomplishedOn - DateUtil.now()) > T.days(1).msecs()) { // more than 1 day in the future
setStartedOn(0);
setAccomplishedOn(0);
}
setupTasks(tasks);
for (Task task : tasks) task.objective = this;
}
@ -53,7 +57,7 @@ public abstract class Objective {
}
public boolean isAccomplished() {
return accomplishedOn != 0;
return accomplishedOn != 0 && accomplishedOn < DateUtil.now();
}
public boolean isStarted() {

View file

@ -75,7 +75,7 @@
<string name="whatistrue">What is true?</string>
<string name="update_git">You need to have Git installed.</string>
<string name="update_asap">Update as soon as new version is released.</string>
<string name="update_keys">You can use the same signing keys.</string>
<string name="update_keys">You should use the same signing keys.</string>
<string name="update_neverupdate">Never update if the system is working well.</string>
<string name="update_askfriend">Ask your friend for the new APK.</string>
<string name="update_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch</string>
@ -142,7 +142,7 @@
<string name="profileswitch_iclower">IC value will be 10% lower.</string>
<string name="profileswitch_isfhigher">ISF value will be 10% higher.</string>
<string name="profileswitch_isflower">ISF value will be 10% lower.</string>
<string name="profileswitch_overall">You will get 10% less insulin in total.</string>
<string name="profileswitch_overall">You will get around 10% less insulin in total.</string>
<string name="profileswitch_targethigher">Target wiil be 10% higher.</string>
<string name="profileswitch_targetlower">Target will be 10% lower.</string>
<string name="profileswitch_targetbottom">Only bottom target will be 10% lower.</string>