Add notes to DelayedToggle, make delay skipable

This commit is contained in:
2022-04-12 15:22:28 -05:00
parent 7187214282
commit 0de6896691
7 changed files with 29 additions and 23 deletions

View File

@@ -123,8 +123,7 @@ open class ListHabitsBehavior @Inject constructor(
if (prefs.isFirstRun) onFirstRun()
}
fun onToggle(habit: Habit, timestamp: Timestamp?, value: Int) {
val notes = habit.computedEntries.get(timestamp!!).notes
fun onToggle(habit: Habit, timestamp: Timestamp, value: Int, notes: String) {
commandRunner.run(
CreateRepetitionCommand(habitList, habit, timestamp, value, notes)
)

View File

@@ -168,7 +168,12 @@ class ListHabitsBehaviorTest : BaseUnitTest() {
@Test
fun testOnToggle() {
assertTrue(habit1.isCompletedToday())
behavior.onToggle(habit1, getToday(), Entry.NO)
behavior.onToggle(
habit = habit1,
timestamp = getToday(),
value = Entry.NO,
notes = ""
)
assertFalse(habit1.isCompletedToday())
}
}