diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/models.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/program/models.py b/program/models.py index 764cfbf..a63fcc7 100644 --- a/program/models.py +++ b/program/models.py @@ -195,10 +195,18 @@ class ProgramSlot(models.Model): byweekday_start = self.byweekday if self.tend < self.tstart: - byweekday_end = self.byweekday + 1 if self.byweekday < 6 else 0 + if self.byweekday < 6: + byweekday_end = self.byweekday + 1 + else: + byweekday_end = 0 else: byweekday_end = self.byweekday + if self.tend < self.tstart: + dend = self.dstart + timedelta(days=+1) + else: + dend = self.dstart + starts = list(rrule(freq=self.rrule.freq, dtstart=datetime.combine(self.dstart, self.tstart), interval=self.rrule.interval, @@ -206,7 +214,7 @@ class ProgramSlot(models.Model): bysetpos=self.rrule.bysetpos, byweekday=byweekday_start)) ends = list(rrule(freq=self.rrule.freq, - dtstart=datetime.combine(self.dstart, self.tend), + dtstart=datetime.combine(dend, self.tend), interval=self.rrule.interval, until=self.until+relativedelta(days=+1), bysetpos=self.rrule.bysetpos, |