Recalculate dtstart and dtend on every save now that it is idempotwhatever

This commit is contained in:
Matthew Jones 2014-04-01 10:09:48 -04:00
parent 008ec8f86e
commit 2e6457b887

View File

@ -91,10 +91,11 @@ class Schedule(CommonModel):
next_run_actual = future_rs.after(now())
self.next_run = next_run_actual
if self.dtstart is None:
self.dtstart = future_rs[0]
if self.dtend is None and "until" in self.rrule.lower() or 'count' in self.rrule.lower():
self.dtstart = future_rs[0]
if "until" in self.rrule.lower() or 'count' in self.rrule.lower():
self.dtend = future_rs[-1]
else:
self.dtend = None
self.unified_job_template.update_computed_fields()
def save(self, *args, **kwargs):