/examples/dynamictable/Schedule.py
Python | 22 lines | 18 code | 4 blank | 0 comment | 6 complexity | e973e66e494559e1a4adc777fabdb5eb MD5 | raw file
1from TimeSlot import TimeSlot 2 3class Schedule: 4 5 def __init__(self): 6 self.timeSlots = [] 7 8 def addTimeSlot(self, timeSlot): 9 self.timeSlots.append(timeSlot) 10 11 def getDescription(self, daysFilter): 12 s = None 13 for timeSlot in self.timeSlots: 14 if daysFilter[timeSlot.dayOfWeek]: 15 if not s: 16 s = timeSlot.getDescription() 17 else: 18 s += ", " + timeSlot.getDescription() 19 if s: 20 return s 21 else: 22 return ""