def get_all_participants_in_facility(manager, facility_name): rooms = Room.get_by_facility(manager.company, facility_name) if rooms is None: return sum_visits = 0 for room in rooms: schedules = Schedule.get_by_room_and_date( room._id, datetime.now().strftime('%d/%m/%Y')) for sched in schedules: sum_visits += len(sched.participants) return sum_visits
def get_meetings_number_in_facility_simulation(manager, facility_name, duration=1): rooms = Room.get_by_facility(manager.company, facility_name) if rooms is None: return sum_meetings = 0 for room in rooms: sum_meetings = 0 for day in range(duration): occupancy = room.get_occupancy(datetime.now(), room._id) sum_meetings += occupancy return sum_meetings / duration
def test_rooms(): Database.initialize() Database.remove('rooms', {}) status, room_id = Room.add_room(2, 30, 1, 3, 'YAHOO', 'matam', True) assert status is True status, room_id = Room.add_room(2, 30, 3, 4, 'YAHOO', 'matam', False) assert status is True assert Room.remove_room(room_id) is True status, room_id = Room.add_room(2, 30, 3, 4, 'YAHOO', 'matam', True) assert status is True assert Room.get_by_id(room_id).company == 'YAHOO' assert len(Room.get_by_company('YAHOO')) > 0 assert len(Room.get_by_facility('YAHOO', 'matam')) > 0 assert len(Room.get_by_capacity(5, 'YAHOO', 'matam', 2)) > 0 assert len(Room.get_by_capacity(50, 'YAHOO', 'matam', 2)) == 0 assert len(Room.get_by_capacity(20, 'YAHOO', 'matam', 3)) > 0 assert len(Room.get_by_capacity(20, 'YAHOO', 'matam', 1)) == 0