]> git.0d.be Git - django-panik-emissions.git/commitdiff
nonstop: handle past-midnight nonstop slots
authorFrédéric Péters <fpeters@0d.be>
Thu, 28 Jun 2018 04:41:02 +0000 (06:41 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 28 Jun 2018 04:41:02 +0000 (06:41 +0200)
emissions/utils.py

index 9e43d4aee38d1f8f6512ebf278e11dd853bb1ce5..2a39216fcf3656db12aaf94b345e74b2b8e556d4 100644 (file)
@@ -211,6 +211,9 @@ def period_program(date_start, date_end, prefetch_sounds=True,
                         nonstop_day_start -= timedelta(days=1)
                     else:
                         nonstop_day_end += timedelta(days=1)
+                elif nonstop.start < dawn:
+                    nonstop_day_start += timedelta(days=1)
+                    nonstop_day_end += timedelta(days=1)
 
                 if nonstop_day_start < end and nonstop_day_end > start:
                     if dt is None: