]> git.0d.be Git - panikweb.git/commitdiff
adapt to new dawn settings
authorFrédéric Péters <fpeters@0d.be>
Sun, 19 Mar 2023 15:21:40 +0000 (16:21 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sun, 19 Mar 2023 15:21:40 +0000 (16:21 +0100)
panikweb/views.py

index 429270ecb0810db68bd9ccb2dcab23ac0a230e41..6fc6cbf90ae70b3a7ff647b79367bd917dec497a 100644 (file)
@@ -21,6 +21,7 @@ from django.views.generic import RedirectView, View
 from django.views.generic.base import TemplateView
 from django.views.generic.dates import MonthArchiveView, _date_from_string
 from django.views.generic.detail import DetailView
+from emissions.app_settings import app_settings as emissions_app_settings
 from emissions.models import (
     Category,
     Diffusion,
@@ -384,8 +385,14 @@ class Grid(TemplateView):
         times = ['%02d:%02d' % (x / 2, x % 2 * 30) for x in range(nb_lines)]
         # start grid after the night programs
         times = (
-            times[2 * Schedule.DAY_HOUR_START + (1 if Schedule.DAY_MINUTE_START else 0) :]
-            + times[: 2 * Schedule.DAY_HOUR_START + (1 if Schedule.DAY_MINUTE_START else 0)]
+            times[
+                2 * emissions_app_settings.DAY_HOUR_START
+                + (1 if emissions_app_settings.DAY_MINUTE_START else 0) :
+            ]
+            + times[
+                : 2 * emissions_app_settings.DAY_HOUR_START
+                + (1 if emissions_app_settings.DAY_MINUTE_START else 0)
+            ]
         )
 
         nonstops = []
@@ -437,13 +444,16 @@ class Grid(TemplateView):
                 time_cell.nonstop = nonstop[2]
                 time_cell.nonstop_slug = nonstop[3]
                 time_cell.redirect_path = nonstop[4].redirect_path if nonstop[4] else None
-                if nonstop[1] == Schedule.DAY_HOUR_START + Schedule.DAY_MINUTE_START / 60:
-                    # the one ending at 4:30am will be cut down, so we inscribe
+                if (
+                    nonstop[1]
+                    == emissions_app_settings.DAY_HOUR_START + emissions_app_settings.DAY_MINUTE_START / 60
+                ):
+                    # the one ending at dawn will be cut down, so we inscribe
                     # its duration manually
                     time_cell.time_label = '%02d:00-%02d:%02d' % (
                         nonstop[0],
                         nonstop[1],
-                        Schedule.DAY_MINUTE_START,
+                        emissions_app_settings.DAY_MINUTE_START,
                     )
 
         for schedule in (
@@ -462,8 +472,14 @@ class Grid(TemplateView):
 
         # start grid after the night programs
         grid = (
-            grid[2 * Schedule.DAY_HOUR_START + (1 if Schedule.DAY_MINUTE_START else 0) :]
-            + grid[: 2 * Schedule.DAY_HOUR_START + (1 if Schedule.DAY_MINUTE_START else 0)]
+            grid[
+                2 * emissions_app_settings.DAY_HOUR_START
+                + (1 if emissions_app_settings.DAY_MINUTE_START else 0) :
+            ]
+            + grid[
+                : 2 * emissions_app_settings.DAY_HOUR_START
+                + (1 if emissions_app_settings.DAY_MINUTE_START else 0)
+            ]
         )
 
         # look for the case where the same emission has different schedules for