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

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

Loading…
Cancel
Save