Fallback for reminder days

This commit is contained in:
jude 2023-06-20 14:44:05 +01:00
parent 1519474f93
commit bb1c61d0b9

View File

@ -345,7 +345,10 @@ WHERE
}
async fn refresh(&self, pool: impl Executor<'_, Database = Database> + Copy) {
if self.interval_seconds.is_some() || self.interval_months.is_some() {
if self.interval_seconds.is_some()
|| self.interval_months.is_some()
|| self.interval_days.is_some()
{
let now = Utc::now();
let mut updated_reminder_time =
self.utc_time.with_timezone(&self.timezone.parse().unwrap_or(Tz::UTC));
@ -365,9 +368,11 @@ WHERE
updated_reminder_time = updated_reminder_time
.checked_add_days(Days::new(interval as u64))
.unwrap_or_else(|| {
warn!("Could not add days to a reminder");
warn!(
"Could not add days to a reminder. Falling back to naive addition"
);
updated_reminder_time
updated_reminder_time + 86400 * interval
});
}