示例#1
0
 def __init__(self):
     for session in Talk.get_talk_sessions():
         room_dict = {}
         for room in Room.get_rooms():
             room_dict[room.name] = None
         self.grid[session]= dict(room_dict)
             
     for talk in Talk.all().fetch(1000):
         if talk.session:
             self.add_talk(talk)
示例#2
0
 def test_get_rows_for_template(self):
     self.talk.room = self.room2
     timetable = Timetable()
     timetable.add_talk(self.talk)
     number_of_sessions = len(Talk.get_talk_sessions())
     self.assertEquals(number_of_sessions, len(timetable.get_rows_for_template()))
     for row in timetable.get_rows_for_template():
         self.assertEquals(2, len(row.talks_by_room()))
         if row.session == 1:
             self.assertEquals(row.talks_by_room()[0], None)
             self.assertEquals(row.talks_by_room()[1], self.talk)                        
示例#3
0
 def get_rows_for_template(self):
     session_rows = []
     contador = 0
     for session in Talk.get_talk_sessions():
         row = SessionRow(session)
         for room in Room.get_rooms():
             if self.grid[session][room.name]:
                 self.grid[session][room.name].contador = contador
             row.add_talk(self.grid[session][room.name])
             contador = contador + 1
         session_rows.append(row)
     return session_rows
示例#4
0
def show_timetable(request):
    user = request.session.get('user')
    timetable = Timetable()
    rooms = Room.get_rooms()
    sessions = Talk.get_talk_sessions()
    return render_to_response('timetable_app.html', {'user': user, 'rooms': rooms, 'sessions': sessions, 'rows': timetable.get_rows_for_template()})
示例#5
0
 def test_empty_schedule_grid(self):
     grid = Timetable().get_grid()
     for session in Talk.get_talk_sessions():
         for room in Room.get_rooms():
             self.assertFalse(grid[session][room.name])