Ignore invalid intervals to compute next call of cron

issue9842
review333571002
This commit is contained in:
Cédric Krier
2021-01-08 22:52:03 +01:00
parent 750b597043
commit cbd2cc3da5
+18 -4
View File
@@ -99,10 +99,24 @@ class Cron(DeactivableMixin, ModelSQL, ModelView):
+ relativedelta(
microsecond=0,
second=0,
minute=self.minute,
hour=self.hour,
day=self.day,
weekday=int(self.weekday.index) if self.weekday else None))
minute=(
self.minute
if self.interval_type != 'minutes'
else None),
hour=(
self.hour
if self.interval_type not in {'minutes', 'hours'}
else None),
day=(
self.day
if self.interval_type not in {
'minutes', 'hours', 'days', 'weeks'}
else None),
weekday=(
int(self.weekday.index)
if self.weekday
and self.interval_type not in {'minutes', 'hours', 'days'}
else None)))
@dualmethod
@ModelView.button