[Legacy] Update AlertSchedulers alert reminder time calculation

Update calculation to on create the notification with the time that as scheduled for
This commit is contained in:
Clemente Raposo 2023-02-20 18:44:21 +00:00
parent dbd0d738ff
commit 1eddcb50bf

View file

@ -89,7 +89,9 @@ class AddScheduledReminderAlerts
continue;
}
if ($this->isOutsideOfExecutionDateRange($relatedEventStart, $dateTimeNowStamp, $dateTimeMaxStamp)) {
$relatedEventStart -= $popupReminder->timer_popup;
if (!$this->isWithinExecutionDateRange($relatedEventStart, $dateTimeNowStamp, $dateTimeMaxStamp)) {
continue;
}
@ -104,8 +106,6 @@ class AddScheduledReminderAlerts
continue;
}
$relatedEventStart -= $popupReminder->timer_popup;
$url = $this->getURL($popupReminder);
$instructions = $this->getInstructions($app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']);
@ -302,10 +302,22 @@ class AddScheduledReminderAlerts
* @param $dateTimeMaxStamp
* @return bool
*/
protected function isOutsideOfExecutionDateRange($relatedEventStart, $dateTimeNowStamp, $dateTimeMaxStamp): bool
protected function isWithinExecutionDateRange($relatedEventStart, $dateTimeNowStamp, $dateTimeMaxStamp): bool
{
return $relatedEventStart
&& ($relatedEventStart <= $dateTimeNowStamp || $relatedEventStart >= $dateTimeMaxStamp);
if (empty($relatedEventStart)) {
return false;
}
//increase time by 10 secs to make sure we calculate within the correct minute
if (($dateTimeNowStamp + 10) < $relatedEventStart) {
return false;
}
if ($relatedEventStart > $dateTimeMaxStamp) {
return false;
}
return true;
}
/**