From 65623ea08e8bde80ee2c2bb2d7396e51301852f0 Mon Sep 17 00:00:00 2001 From: pkorove Date: Sun, 14 Jun 2020 21:52:45 +0300 Subject: [PATCH 1/2] Fix reset from settings not refreshing --- .../uhabits/core/commands/ResetHabitsCommand.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java index e3c5cfe16..be212a615 100644 --- a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java +++ b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java @@ -45,8 +45,15 @@ public class ResetHabitsCommand extends Command habitList.update(selected); } else { for (Habit h : habitList) { - h.getRepetitions().removeAll(); - habitList.update(h); + // h.getRepetitions().removeAll(); + // habitList.update(h); + RepetitionList repetitionList = h.getRepetitions(); + Repetition rep; + while(repetitionList.getTotalCount() != 0) { + rep = repetitionList.getOldest(); + repetitionList.toggle(rep.getTimestamp()); + repetitionList.remove(rep); + } } } } From 9bb1a49ac65178852125b60bab348a06d5830e40 Mon Sep 17 00:00:00 2001 From: pkorove Date: Sun, 14 Jun 2020 21:53:26 +0300 Subject: [PATCH 2/2] Deleted unneeded comments --- .../org/isoron/uhabits/core/commands/ResetHabitsCommand.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java index be212a615..2e226a882 100644 --- a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java +++ b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java @@ -45,8 +45,6 @@ public class ResetHabitsCommand extends Command habitList.update(selected); } else { for (Habit h : habitList) { - // h.getRepetitions().removeAll(); - // habitList.update(h); RepetitionList repetitionList = h.getRepetitions(); Repetition rep; while(repetitionList.getTotalCount() != 0) {