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
Thierry Carrez 3 years ago
1 changed files with 8 additions and 2 deletions
  1. +8

+ 8
- 2
ptgbot/ 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[]
for room, bookings in['scheduled'].items():
if today not in['slots']:
today = next(iter(['slots']))
all_schedule = chain(['scheduled'].items(),['additional'].items())
for room, bookings in all_schedule:
for btime, btrack in bookings.items():
for slot in['slots'].get(today, []):
if btrack == track and btime == slot['name']: