Browse Source

Also find room for tracks in additional rooms

The get_track_room function failed to also look in
additional rooms to find the room for a given track.

If the event is not running in the current day, we
should default to the first day of the event (useful
for tests and the day before the event starts).

Change-Id: I143eb3b490b3536679e0608064209ec71ed37499
changes/48/529848/1
Thierry Carrez 3 years ago
parent
commit
d57f89dcb9
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      ptgbot/db.py

+ 8
- 2
ptgbot/db.py View File

@ -15,6 +15,7 @@
# limitations under the License.
import calendar
from itertools import chain
import json
import os
import datetime
@ -73,9 +74,14 @@ class PTGDataBase():
def get_track_room(self, track):
# This simplified version returns the first room the track is
# scheduled in for the day
# scheduled in for the day. If the event does not run on this
# day, pick the first day.
today = calendar.day_name[datetime.date.today().weekday()]
for room, bookings in self.data['scheduled'].items():
if today not in self.data['slots']:
today = next(iter(self.data['slots']))
all_schedule = chain(self.data['scheduled'].items(),
self.data['additional'].items())
for room, bookings in all_schedule:
for btime, btrack in bookings.items():
for slot in self.data['slots'].get(today, []):
if btrack == track and btime == slot['name']:


Loading…
Cancel
Save