Don't adjust random reminder time

pull/2884/head
Alex Baker 6 months ago
parent 89465f36b3
commit f8f8ba3c51

@ -1,6 +1,5 @@
package com.todoroo.astrid.alarms
import com.todoroo.andlib.utility.DateUtilities
import com.todoroo.astrid.data.Task
import org.tasks.data.Alarm
import org.tasks.jobs.AlarmEntry
@ -81,10 +80,7 @@ class AlarmCalculator(
`when` = task.creationDate
}
`when` += (reminderPeriod * (0.85f + 0.3f * random.nextFloat())).toLong()
if (`when` < DateUtilities.now()) {
`when` = Math.max(DateUtilities.now(), task.hideUntil)
}
return `when`
return Math.max(`when`, task.hideUntil)
}
return AlarmService.NO_ALARM
}

@ -310,7 +310,7 @@ class AlarmCalculatorTest {
)
assertEquals(
newAlarmEntry(with(TIME, now), with(TYPE, TYPE_RANDOM)),
newAlarmEntry(with(TIME, now.minusDays(14).plusMillis(584206592)), with(TYPE, TYPE_RANDOM)),
alarm
)
}

Loading…
Cancel
Save