Fixed calendar actions

This commit is contained in:
Adolfo Gómez García 2020-10-16 11:46:18 +02:00
parent bbae1dca44
commit e8698316c6

View File

@ -232,7 +232,11 @@ class CalendarAction(UUIDModel):
def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
lastExecution = self.last_execution or getSqlDatetime()
self.next_execution = calendar.CalendarChecker(self.calendar).nextEvent(checkFrom=lastExecution-self.offset, startEvent=self.at_start) + self.offset
possibleNext = calendar.CalendarChecker(self.calendar).nextEvent(checkFrom=lastExecution-self.offset, startEvent=self.at_start)
if possibleNext:
self.next_execution = possibleNext + self.offset
else:
self.next_execution = None
super().save(force_insert, force_update, using, update_fields)