mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Only recalculate all list positions when repairing database
This commit is contained in:
@@ -27,6 +27,7 @@ import org.isoron.uhabits.activities.habits.list.controllers.*;
|
||||
import org.isoron.uhabits.activities.habits.list.model.*;
|
||||
import org.isoron.uhabits.commands.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.models.sqlite.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.tasks.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
@@ -159,11 +160,19 @@ public class ListHabitsController
|
||||
public void onRepairDB()
|
||||
{
|
||||
taskRunner.execute(() -> {
|
||||
for(Habit h : habitList) {
|
||||
for(Habit h : habitList)
|
||||
{
|
||||
h.getCheckmarks().invalidateNewerThan(0);
|
||||
h.getStreaks().invalidateNewerThan(0);
|
||||
h.getScores().invalidateNewerThan(0);
|
||||
}
|
||||
|
||||
if(habitList instanceof SQLiteHabitList)
|
||||
{
|
||||
SQLiteHabitList sqlList = (SQLiteHabitList) habitList;
|
||||
sqlList.rebuildOrder();
|
||||
}
|
||||
|
||||
screen.showMessage(R.string.database_repaired);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -210,10 +210,7 @@ public class SQLiteHabitList extends HabitList
|
||||
|
||||
fromRecord.position = toPos;
|
||||
fromRecord.save();
|
||||
|
||||
update(from);
|
||||
rebuildOrder();
|
||||
|
||||
getObservable().notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user