Skip to content
Snippets Groups Projects
Commit 7d7bf134 authored by David Trattnig's avatar David Trattnig
Browse files

Skip ended timeslot. engine-clock#2

parent f33509cf
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import sqlalchemy
from dateutil.parser import parse
from base.node import NodeType
from rest import util
from models import \
PlayLog, PlayLogSchema, TrackSchema, ActivityLog, \
ClockInfo, ClockInfoSchema, HealthHistory, HealthHistorySchema
......@@ -188,7 +189,14 @@ class ApiService():
"""
Retrieves the dataset required to render the studio clock.
"""
info = ClockInfo.get_info(self.get_active_source())
info = ClockInfo.get_info(self.get_active_source())
now = datetime.datetime.now()
if info["current_timeslot"] and info["current_timeslot"]["timeslot_end"]:
timeslot_end = util.deserialize_datetime(info["current_timeslot"]["timeslot_end"])
if timeslot_end < now:
info["current_timeslot"] = None
clockinfo_schema = ClockInfoSchema()
return clockinfo_schema.dump(info)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment