fix: Fix a critical bug that caused the app to generate database entries in an infinite loop

This commit is contained in:
Nishant Mishra
2025-07-13 08:53:02 +05:30
parent 954eb47086
commit 7541bd84dd

View File

@@ -89,11 +89,9 @@ class TimerViewModel(
val today = LocalDate.now()
// Fills dates between today and lastDate with 0s to ensure continuous history
lastDate?.until(today)?.days?.let {
while (it > 0) {
lastDate = lastDate?.plusDays(1)
statRepository.insertStat(Stat(lastDate!!, 0, 0, 0, 0, 0))
}
while ((lastDate?.until(today)?.days ?: -1) > 0) {
lastDate = lastDate?.plusDays(1)
statRepository.insertStat(Stat(lastDate!!, 0, 0, 0, 0, 0))
}
delay(1500)