Skip to content

Commit d375a70

Browse files
committed
schedule_frab_json: use existing functions from schedule_xml
1 parent b153466 commit d375a70

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

apps/schedule/feeds.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from models.cfp import Proposal
1313

1414
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
1616
from .historic import feed_historic
1717
from .data import (
1818
_get_scheduled_proposals,
@@ -67,14 +67,6 @@ def schedule_frab_json(year):
6767
if not feature_enabled("SCHEDULE"):
6868
abort(404)
6969

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-
7870
schedule = (
7971
Proposal.query.filter(
8072
Proposal.is_accepted,
@@ -113,10 +105,11 @@ def duration_hhmm(duration_minutes):
113105

114106
for day in range(0, duration_days):
115107
day_dt = event_start() + timedelta(days=day)
108+
day_start, day_end = get_day_start_end(day_dt)
116109
day_schedule = {
117110
"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(),
120113
"index": day,
121114
"rooms": {},
122115
}
@@ -141,7 +134,7 @@ def duration_hhmm(duration_minutes):
141134
"date": event_tz.localize(proposal.start_date).isoformat(),
142135
"description": proposal.description,
143136
"do_not_record": proposal.video_privacy != "public",
144-
"duration": duration_hhmm(proposal.duration_minutes),
137+
"duration": get_duration(proposal.start_date, proposal.end_date),
145138
"guid": None,
146139
"id": proposal.id,
147140
# This assumes there will never be a non-english talk,

0 commit comments

Comments
 (0)