12
12
from models .cfp import Proposal
13
13
14
14
from ..common import feature_flag , feature_enabled , json_response
15
- from .schedule_xml import export_frab
15
+ from .schedule_xml import export_frab , get_day_start_end , get_duration
16
16
from .historic import feed_historic
17
17
from .data import (
18
18
_get_scheduled_proposals ,
@@ -67,14 +67,6 @@ def schedule_frab_json(year):
67
67
if not feature_enabled ("SCHEDULE" ):
68
68
abort (404 )
69
69
70
- def duration_hhmm (duration_minutes ):
71
- if not duration_minutes or duration_minutes < 1 :
72
- return "00:00"
73
- return "{}:{}" .format (
74
- int (duration_minutes / 60 ),
75
- str (duration_minutes % 60 ).zfill (2 ),
76
- )
77
-
78
70
schedule = (
79
71
Proposal .query .filter (
80
72
Proposal .is_accepted ,
@@ -113,10 +105,11 @@ def duration_hhmm(duration_minutes):
113
105
114
106
for day in range (0 , duration_days ):
115
107
day_dt = event_start () + timedelta (days = day )
108
+ day_start , day_end = get_day_start_end (day_dt )
116
109
day_schedule = {
117
110
"date" : day_dt .strftime ("%Y-%m-%d" ),
118
- "day_end" : ( day_dt . replace ( hour = 3 , minute = 59 , second = 59 ) + timedelta ( days = 1 )) .isoformat (),
119
- "day_start" : day_dt . replace ( hour = 4 , minute = 0 , second = 0 ) .isoformat (),
111
+ "day_end" : day_start .isoformat (),
112
+ "day_start" : day_end .isoformat (),
120
113
"index" : day ,
121
114
"rooms" : {},
122
115
}
@@ -141,7 +134,7 @@ def duration_hhmm(duration_minutes):
141
134
"date" : event_tz .localize (proposal .start_date ).isoformat (),
142
135
"description" : proposal .description ,
143
136
"do_not_record" : proposal .video_privacy != "public" ,
144
- "duration" : duration_hhmm (proposal .duration_minutes ),
137
+ "duration" : get_duration (proposal .start_date , proposal . end_date ),
145
138
"guid" : None ,
146
139
"id" : proposal .id ,
147
140
# This assumes there will never be a non-english talk,
0 commit comments