File: Schedule.py

package info (click to toggle)
pyjamas 0.7~%2Bpre2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,656 kB
  • ctags: 12,331
  • sloc: python: 74,493; php: 805; sh: 291; makefile: 59; xml: 9
file content (24 lines) | stat: -rw-r--r-- 639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from TimeSlot import TimeSlot

class Schedule:

    def __init__(self, timeSlots = None):
        self.timeSlots = []
        if timeSlots:
            self.timeSlots = timeSlots

    def addTimeSlot(self, timeSlot):
        self.timeSlots.append(timeSlot)
        
    def getDescription(self, daysFilter):
        s = None
        for timeSlot in self.timeSlots:
            if daysFilter[timeSlot.dayOfWeek]:
                if not s:
                    s = timeSlot.getDescription()
                else:
                    s += ", " + timeSlot.getDescription()
        if s:
            return s
        else:
            return ""