From f8f8ba3c51e8583f7cdcf77eb34c02939f554b22 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Thu, 9 May 2024 23:21:30 -0500 Subject: [PATCH] Don't adjust random reminder time --- .../main/java/com/todoroo/astrid/alarms/AlarmCalculator.kt | 6 +----- .../java/com/todoroo/astrid/alarms/AlarmCalculatorTest.kt | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/alarms/AlarmCalculator.kt b/app/src/main/java/com/todoroo/astrid/alarms/AlarmCalculator.kt index db741a4fb..f94f63b6a 100644 --- a/app/src/main/java/com/todoroo/astrid/alarms/AlarmCalculator.kt +++ b/app/src/main/java/com/todoroo/astrid/alarms/AlarmCalculator.kt @@ -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 } diff --git a/app/src/test/java/com/todoroo/astrid/alarms/AlarmCalculatorTest.kt b/app/src/test/java/com/todoroo/astrid/alarms/AlarmCalculatorTest.kt index 018235cd2..4a007cbc1 100644 --- a/app/src/test/java/com/todoroo/astrid/alarms/AlarmCalculatorTest.kt +++ b/app/src/test/java/com/todoroo/astrid/alarms/AlarmCalculatorTest.kt @@ -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 ) }