Example #1
0
def test_schedules_orders4():
    User.print_values()
    Database.initialize()
    Database.dropAll()
    # Database.find_one('orders', {'_id' : '23/05/18' })
    # num1 = Database.count('orders')
    # Database.remove('orders', {'_id': '23/05/18'})
    # num2 = Database.count('orders')

    Manager.manager_register("*****@*****.**", 'admin', 'Admin admin', '000000000', 'eng', 1, 'YAHOO', 'matam')

    status, room_id = Room.add_room(2, 2, 1, 3, 'YAHOO', 'matam',
                                    True)  ########################################changed capacity
    assert status is True
    status, room_id = Room.add_room(2, 1, 3, 4, 'YAHOO', 'matam', False)
    assert status is True
    assert Room.remove_room(room_id) is True
    status, room_id = Room.add_room(2, 1, 3, 4, 'YAHOO', 'matam', True)
    status, room_id = Room.add_room(2, 2, 4, 4, 'YAHOO', 'matam', True)

    num1 = Database.count('orders')
    Database.remove('orders', {'_id': '23/05/18'})
    num2 = Database.count('orders')
    Database.remove('orders', {'date': '26/05/18'})
    num3 = Database.count('orders')
    num_users1 = Database.count('users')
    Manager.user_register("*****@*****.**", '123', 'foox', '000002600', 'eng', 3, 'YAHOO', 'matam')
    Manager.user_register("*****@*****.**", '123', 'yan', '026000000', 'eng', 3, 'YAHOO', 'matam')
    Manager.user_register("*****@*****.**", '456', 'bim', '313324360', 'eng', 3, 'YAHOO', 'matam')
    num_users2 = Database.count('users')
    user2 = User.get_by_email('*****@*****.**')
    user3 = User.get_by_email('*****@*****.**')

    manager = Manager.get_by_email('*****@*****.**')
    assert manager is None
    manager = Manager.get_by_email('*****@*****.**')
    assert manager is not None
    try:
        manager.import_rooms(os.getcwd() + '\\rooms.csv')
        manager.import_employee(os.getcwd() + '\\employee.csv')
    # should'nt works on travis
    except Exception as e:
        pass
    num_users2 = Database.count('users')

    user1 = User.get_by_email('*****@*****.**')
    user2 = User.get_by_email('*****@*****.**')
    user3 = User.get_by_email('*****@*****.**')
    participants1 = ['*****@*****.**', '*****@*****.**']
    participants2 = ['*****@*****.**']
    participants3 = ['*****@*****.**', '*****@*****.**']
    # date = datetime.utcnow().strftime('%d/%m/%y')
    date = '21/06/18'
    status2, string2 = user2.new_order(date, participants2, 6, 7, "YAHOO", 'matam')
    schedules2 = user2.get_schedule()
    assert status2 == True
    date_next = '22/06/18'
    status3, string3 = user2.new_order(date_next, participants2, 6, 7, "YAHOO", 'matam')
    # assert status3==True
    schedules2 = user2.get_schedule()
Example #2
0
 def test_internal_create_room_succeed(self):
     request = InternalMessage("a", "command", "d")
     rooms = [Room("a", 10), Room("b", 2), Room("c", 1)]
     succeed, response = self.controller.internal_create_room(request, rooms)
     self.assertEqual(succeed, True)
     self.assertEqual(response.get_identity(), "a")
     self.assertEqual(response.get_command(), Proxy.Commands.send.name)
     self.assertEqual(response.get_arguments(), Rooms.Text.CREATED.format("d"))
Example #3
0
 def test_internal_created_room_failed(self):
     request = InternalMessage("b", "command", "a")
     rooms = [Room("a", 10), Room("b", 2), Room("c", 1)]
     succeed, response = self.controller.internal_create_room(request, rooms)
     self.assertEqual(succeed, False)
     self.assertEqual(response.get_identity(), "b")
     self.assertEqual(response.get_command(), Proxy.Commands.send.name)
     self.assertEqual(response.get_arguments(), Rooms.Text.ERROR_ROOM_EXIST.format("a"))
Example #4
0
    def test_from_valid_json(self):
        json = {"name": "a", "connected_users": 10}
        message = Room.from_json(json)
        self.assertEqual(message.get_name(), "a")
        self.assertEqual(message.get_connected_users(), 10)

        json = {"name": "a"}
        message = Room.from_json(json)
        self.assertEqual(message.get_name(), "a")
        self.assertEqual(message.get_connected_users(), 0)
Example #5
0
    def test_build_list_rooms(self):
        rooms = [Room("a", 10), Room("b", 2), Room("c", 1)]
        list = self.controller.build_list_rooms(rooms)
        expected_text = Rooms.Text.ACTIVE_ROOMS + \
                        Rooms.Text.ROOM.format("a", 10) + Rooms.Text.ROOM.format("b", 2) + Rooms.Text.ROOM.format("c", 1) + \
                        Rooms.Text.END_LIST
        self.assertEqual(list, expected_text)

        rooms = []
        list = self.controller.build_list_rooms(rooms)
        expected_text = Rooms.Text.ACTIVE_ROOMS + \
                        Rooms.Text.END_LIST
        self.assertEqual(list, expected_text)
Example #6
0
def add_random_rooms_simulation(maxRooms, manager):
    '''
    the function creates random rooms and adds them to the simulation engine
    :param maxRooms: maximum of rooms in the simulation can't be zero
    :param manager: the manager of the simulation
    '''
    global NUM_ROOMS
    global NUM_FACILITIES
    NUM_ROOMS = random.randint(1, maxRooms)
    for i in range():
        Room.add_room_simulation(
            random.randint(1, 3), random.randint(30, 100), i,
            random.randint(5, 8),
            "facility" + str(random.randint(1, NUM_FACILITIES)), True)
Example #7
0
def test_schedules_orders():
    Database.initialize()
    Database.dropAll()
    Manager.manager_register("*****@*****.**", 'admin', 'Admin admin', '000000000', 'eng', 1, 'YAHOO', 'matam')

    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)

    num1 = Database.count('orders')
    Database.remove('orders', {'_id': '23/05/18'})
    num2 = Database.count('orders')
    Database.remove('orders', {'date': '26/05/18'})
    num3 = Database.count('orders')
    num_users1 = Database.count('users')
    Manager.user_register("*****@*****.**", '123', 'foox', '000002600', 'eng', 3, 'YAHOO', 'matam')
    Manager.user_register("*****@*****.**", '123', 'yan', '026000000', 'eng', 3, 'YAHOO', 'matam')
    num_users2 = Database.count('users')

    manager = Manager.get_by_email('*****@*****.**')
    assert manager is None
    manager = Manager.get_by_email('*****@*****.**')
    assert manager is not None
    try:
        manager.import_rooms(os.getcwd() + '\\rooms.csv')
        manager.import_employee(os.getcwd() + '\\employee.csv')
    # should'nt works on travis
    except Exception as e:
        pass
    num_users2 = Database.count('users')

    user = User.get_by_email('*****@*****.**')
    participants = ['*****@*****.**', '*****@*****.**']
    date = datetime.utcnow().strftime('%d/%m/%y')
    date = '26/06/18'
    status, string = user.new_order(date, participants, 1, 2, "YAHOO", 'matam')
    print(string)
    orders = user.get_orders()
    num_orders = len(orders)
    assert len(user.get_orders()) > 0
    schedules = user.get_schedule()
    assert len(schedules) > 0
    schedules = Schedule.get_schedules('*****@*****.**')
    assert len(Schedule.get_by_room("YAHOO matam 1")) > 0
    assert len(Room.available_rooms('11/11/11', 2, 1, 2, 2, 'YAHOO', 'matam')) > 0
Example #8
0
 def getRoom(self):
     room = Room.getByName("ac12")
     print room
     if room != None:
         print room.name
         print room.room_id
         print room.capacity
Example #9
0
def addUserToFreeRoom(user): #returns None if an error occurs in room organization
    max_room_id = 0
    if rooms:#if there are rooms, get the biggest one and find the id
        max_room_id = max(room.room_id for room in rooms)
        max_room = getRoomById(max_room_id)
        if max_room == None:
             return None
        if max_room.playerCount() < 2: #max room
            if(max_room.addPlayer(user) == None):
                return None
            rooms.append(max_room)
            return max_room
    new_room = Room(max_room_id + 1)#create the new largest room
    new_room.addPlayer(user)
    rooms.append(new_room)
    return new_room
Example #10
0
def addUserToFreeRoom(
        user):  #returns None if an error occurs in room organization
    max_room_id = 0
    if rooms:  #if there are rooms, get the biggest one and find the id
        max_room_id = max(room.room_id for room in rooms)
        max_room = getRoomById(max_room_id)
        if max_room == None:
            return None
        if max_room.playerCount() < 2:  #max room
            if (max_room.addPlayer(user) == None):
                return None
            rooms.append(max_room)
            return max_room
    new_room = Room(max_room_id + 1)  #create the new largest room
    new_room.addPlayer(user)
    rooms.append(new_room)
    return new_room
Example #11
0
 def get_meeting_number(manager):
     all_rooms = Room.get_by_company(manager.company)
     if all_rooms is None:
         return
     meetings = []
     for room in all_rooms:
         occupancy = int(room.get_occupancy(datetime.now(), room._id))
         meetings.append(occupancy)
     return functools.reduce(lambda a, b: a + b, meetings)
Example #12
0
 def create_room(self, internal_message):
     succeed, message = self.internal_create_room(internal_message,
                                                  self.rooms)
     self.pusher.send_json(message.to_json())
     if not succeed:
         return
     self.rooms.append(Room(internal_message.get_arguments()))
     # Broadcast the change
     self.share_rooms()
Example #13
0
 def get_meetings_number_in_facility(manager, facility_name):
     rooms = Room.get_by_facility_simulation(manager.company, facility_name)
     if rooms is None:
         return
     sum_meetings = 0
     for room in rooms:
         occupancy = room.get_occupancy(datetime.now(), room._id)
         sum_meetings += occupancy
     return sum_meetings
Example #14
0
 def get_all_rooms_occupancy(manager):
     all_rooms = Room.get_by_company(manager.company)
     if all_rooms is None:
         return
     occupancies = []
     for room in all_rooms:
         occupancy = room.get_occupancy(datetime.now(), room._id)
         occupancies.append(
             (room._id, (int(occupancy) * 100) / int(room.capacity)))
     return occupancies
Example #15
0
    def test_internal_get_rooms(self):
        request = InternalMessage("a", "command")
        rooms = [Room("a", 10), Room("b", 2), Room("c", 1)]
        expected_text = Rooms.Text.ACTIVE_ROOMS + \
                        Rooms.Text.ROOM.format("a", 10) + Rooms.Text.ROOM.format("b", 2) + Rooms.Text.ROOM.format("c", 1) + \
                        Rooms.Text.END_LIST
        response = self.controller.internal_get_rooms(request, rooms)
        self.assertEqual(response.get_identity(), "a")
        self.assertEqual(response.get_command(), Proxy.Commands.send.name)
        self.assertEqual(response.get_arguments(), expected_text)

        request = InternalMessage("b", "command")
        rooms = []
        expected_text = Rooms.Text.ACTIVE_ROOMS + \
                        Rooms.Text.END_LIST
        response = self.controller.internal_get_rooms(request, rooms)
        self.assertEqual(response.get_identity(), "b")
        self.assertEqual(response.get_command(), Proxy.Commands.send.name)
        self.assertEqual(response.get_arguments(), expected_text)
Example #16
0
async def mau(websocket, path):
    # register(websocket) sends user_event() to websocket
    await register(websocket)
    try:
        async for message in websocket:
            data = json.loads(message)

            if data["action"] == "create_room":
                player = Player(data["name"], websocket)
                room = Room(player)
                ROOMS.append(room)
                await notify_users_about_rooms()

            elif data["action"] == "join_room":
                player_name = data["player_name"]
                player = Player(player_name, websocket)
                LONELY_USERS.remove(player.websocket)
                room = get_room_by_name(data["room_name"])
                await room.add_player(player)
                await notify_users_about_rooms()

            elif data["action"] == "start_game":
                room = get_room_by_name(data["room_name"])
                await room.start_round()

            elif data["action"] == "put_card":
                player_name = data["player_name"]
                card = data["card"]
                room = get_room_by_name(data["room_name"])
                player = room.get_player_by_name(player_name)
                card = Card(card["number"], get_enum_from_suit_type(card["type"]))
                await room.round.play(player, card)

            elif data["action"] == "take_card":
                player_name = data["player_name"]
                room = get_room_by_name(data["room_name"])
                player = room.get_player_by_name(player_name)
                await room.round.draw(player)
            else:
                logging.error("unsupported event: {}", data)
    finally:
        logging.info("unregistered");
        await unregister(websocket)
Example #17
0
def createRoom(rec):
    if rec['room_type'] == 'Entire home/apt':
        rt = RoomTypes.house
    if rec['room_type'] == 'Private room':
        rt = RoomTypes.private_room
    if rec['room_type'] == 'Shared room':
        rt = RoomTypes.shared_room

    hosts = User.query.filter_by(isHost=True).all()
    ind = random.randrange(len(hosts))
    host = hosts[ind]

    lounge = bool(random.getrandbits(1))
    smoking = bool(random.getrandbits(1))
    pets = bool(random.getrandbits(1))
    events = bool(random.getrandbits(1))
    wifi = bool(random.getrandbits(1))
    ac = bool(random.getrandbits(1))
    refr = bool(random.getrandbits(1))
    kitch = bool(random.getrandbits(1))
    tv = bool(random.getrandbits(1))
    parking = bool(random.getrandbits(1))
    elev = bool(random.getrandbits(1))
    area = random.randrange(150)

    room = Room(rt=rt,
                beds_num=rec['beds'],
                baths_num=rec['bathrooms'],
                bedr_num=rec['bedrooms'],
                lounge=lounge,
                desc=rec['description'],
                smoking_all=smoking,
                pets_all=pets,
                events_all=events,
                wifi=wifi,
                ac=ac,
                refrigerator=refr,
                kitchen=kitch,
                tv=tv,
                parking=parking,
                elevator=elev,
                latitude=rec['latitude'],
                longitude=rec['longitude'],
                address=rec['street'] + ',' + rec['city'],
                tran_info=rec['transit'],
                pers_num=rec['guests_included'],
                standard_cost=rec['price'],
                add_prs_cost=3,
                title=rec['name'],
                area=area,
                min_stay=rec['minimum_nights'],
                owner_id=host.id,
                listing_id=rec['id'])
    db.session.add(room)
Example #18
0
 def get_meeting_number_simulation(manager, duration):
     all_rooms = Room.get_by_company_simulation(manager.company)
     if all_rooms is None:
         return
     sum_meetings = []
     for day in range(duration):
         for room in all_rooms:
             occupancy = room.get_occupancy_simulation(
                 datetime.now() + timedelta(days=day), room._id)
             sum_meetings += occupancy
     return sum_meetings / duration
Example #19
0
 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
Example #20
0
 def get_all_participants_in_facility_simulation(manager, facility_name,
                                                 duration):
     rooms = Room.get_by_facility_simulation(manager.company, facility_name)
     if rooms is None:
         return
     sum_visits = 0
     for day in range(duration):
         for room in rooms:
             schedules = Schedule.get_by_room_and_date_simulation(
                 room._id, (datetime.now() +
                            timedelta(days=day)).strftime('%d/%m/%Y'))
             for sched in schedules:
                 sum_visits += len(sched.participants)
     return sum_visits / duration
Example #21
0
    def try_schedule_simple_algorithm(self, company, facility, min_permission,
                                      participant_num):
        rooms = Room.available_rooms(self.date, participant_num,
                                     self.start_time, self.end_time,
                                     min_permission, company, facility)

        print('here the rooms available')
        print(rooms)
        for room in rooms:
            if room.available_on_time(self.date, self.start_time,
                                      self.end_time, participant_num):
                print('available')
                return self._id, room._id
        return False, 'fail'
Example #22
0
    def bactracking_algorithm_simulation(cls, all_conflict_orders, facility,
                                         date, start_time, end_time):
        all_rooms = list(Room.find_by_facility_simulation(facility))
        list_room_id = []
        for room in all_rooms:
            room_id = room._id
            list_room_id.append(room_id)
        perm_list = list(permutations(all_rooms, len(all_rooms)))

        for i in perm_list:
            is_sucess, room_id = cls.simple_algo_simulation(
                all_conflict_orders, i, date, start_time, end_time)
            if is_sucess:
                return True, room_id,
        return False, "no room"
Example #23
0
 def get_all_rooms_occupancy_simulation(manager, duration):
     all_rooms = Room.get_by_company_simulation(manager.company)
     if all_rooms is None:
         return
     occupancies = []
     sum_occupancy = 0
     for room in all_rooms:
         sum_occupancy = 0
         for day in range(duration):
             sum_occupancy += room.get_occupancy_simulation(
                 datetime.now() + timedelta(days=day), room._id)
         occupancies.append(
             (room._id,
              (sum_occupancy * 100) / (int(room.capacity) * duration)))
     return occupancies
Example #24
0
    def try_schedule_naive_algorithm(self, company, facility, min_permission,
                                     participant_num):
        rooms = Room.available_rooms(self.date, participant_num,
                                     self.start_time, self.end_time,
                                     min_permission, company, facility,
                                     self.min_occupancy, self.max_occupancy,
                                     self.min_friends, self.max_friends,
                                     self.is_accessible)

        print('here the rooms available')
        print(rooms)
        for room in rooms:
            if room.avialable_on_time(self.date, self.start_time,
                                      self.end_time, participant_num):
                return self._id, room._id
        return False, 'fail'
Example #25
0
def get_random_data():
    rooms_number = 100
    rooms = []

    for i in range(rooms_number):
        room = Room(random.choice(list(RoomTypes)), random.randint(1, 5),
                    random.randint(1, 5), random.randint(1, 10),
                    bool(random.getrandbits(1)), "desc",
                    bool(random.getrandbits(1)), bool(random.getrandbits(1)),
                    bool(random.getrandbits(1)), bool(random.getrandbits(1)),
                    bool(random.getrandbits(1)), bool(random.getrandbits(1)),
                    bool(random.getrandbits(1)), bool(random.getrandbits(1)),
                    bool(random.getrandbits(1)), bool(random.getrandbits(1)),
                    37.9754983 + random.uniform(-1, 1),
                    23.7356671 + random.uniform(-1, 1), "address", "info",
                    random.randint(1, 5), random.randint(23, 300),
                    random.uniform(10, 70), random_sentence(3),
                    random.randint(6, 20), random.randint(1, 3), 7)

        for y in range(10):
            room.images.append(
                Image('https://picsum.photos/id/' + str(i * 10 + y) +
                      '/400/400'))
            room.reviews.append(
                Review(random.uniform(1, 5), random_sentence(3),
                       random_sentence(10), 4))

            start_date = datetime.now()

            for x in range(10):
                next_date = start_date + timedelta(days=random.randint(2, 30))

            room.reservations.append(
                Reservation(start_date, next_date, Status.rented))

            start_date = next_date + timedelta(days=random.randint(20, 40))

            next_date = None
            room.reservations.append(
                Reservation(start_date, next_date, Status.not_available))

            db.session.add(room)

            db.session.commit()
Example #26
0
def route_simulation():
    if request.method == 'GET':
        return render_template('Simulation.html',
                               employees_no=0,
                               rooms_no=0,
                               facility_no=0,
                               meetings_no=0,
                               facility_visits_meetings=[("None", 0, 0)],
                               occupancies=[("None", 0)])
    if request.method == 'POST':
        manager = Manager.get_by_email(session['email'])
        if session['email'] is not None and manager is not None:
            duration = int(request.form['duration'])
            max_rooms = int(request.form['room'])
            max_employees = int(request.form['employee'])
            max_facilities = int(request.form['facility'])
            simulation_engine(max_rooms, max_employees, max_facilities,
                              duration)
            employees_no = len(manager.get_employees_simulation())
            facility_no = len(manager.get_facilities_simulation())
            facility_visits_meetings = []
            facilities = manager.get_facilities_simulation()
            for facility in facilities:
                visits = Analytics.get_all_participants_in_facility_simulation(
                    manager, facility, duration)
                meetings = Analytics.get_meetings_number_in_facility_simulation(
                    manager, facility, duration)
                facility_visits_meetings.append((facility, visits, meetings))
            rooms_no = len(Room.get_by_company_simulation(manager.company))
            occupancies = Analytics.get_all_rooms_occupancy_simulation(
                manager, duration)
            meetings_no = Analytics.get_meeting_number_simulation(
                manager, duration)
            return render_template(
                'Simulation.html',
                employees_no=employees_no,
                rooms_no=rooms_no,
                facility_no=facility_no,
                meetings_no=meetings_no,
                facility_visits_meetings=facility_visits_meetings,
                occupancies=occupancies)
Example #27
0
 def simple_algo_simulation(cls, all_conflict_orders, all_rooms, date,
                            start_time, end_time):
     index_room = 0
     already_scheduled = []
     for order in all_conflict_orders:
         order_id = order.get_id()
         participents_order = order.get_participents()
         index_room = Room.get_next_room_from_list_simulation(
             all_rooms, index_room, len(participents_order), date,
             start_time, end_time)
         if index_room == -1:
             cls.remove_conflict_schedule_simulation(
                 already_scheduled, date, start_time, end_time)
             return False, "There is no room"
         room = all_rooms[index_room]
         room_id = room.get_id_room()
         Schedule.assign_all_simulation(date, participents_order,
                                        start_time, end_time, order_id,
                                        room_id)
         scheds_by_order = Schedule.get_by_order_simulation(order_id)
         already_scheduled.append(scheds_by_order[0])
     return True, room_id
Example #28
0
def route_analytics():
    manager = Manager.get_by_email(session['email'])
    if session['email'] is not None and manager is not None:
        employees_no = len(manager.get_employees())
        facility_no = len(manager.get_facilities())
        facility_visits_meetings = []
        facilities = manager.get_facilities()
        for facility in facilities:
            visits = Analytics.get_all_participants_in_facility(
                manager, facility)
            meetings = Analytics.get_meetings_number_in_facility(
                manager, facility)
            facility_visits_meetings.append((facility, visits, meetings))
        rooms_no = len(Room.get_by_company(manager.company))
        occupancies = Analytics.get_all_rooms_occupancy(manager)
        meetings_no = Analytics.get_meeting_number(manager)
        return render_template(
            'Analytics.html',
            employees_no=employees_no,
            rooms_no=rooms_no,
            facility_no=facility_no,
            meetings_no=meetings_no,
            facility_visits_meetings=facility_visits_meetings,
            occupancies=occupancies)
Example #29
0
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
Example #30
0
def test_analytics():
    Database.initialize()
    Database.dropAll()

    assert Analytics.get_num_employees_facility_simulation('YAHOO', 'matam') == 0

    Manager.manager_register("*****@*****.**", 'admin', 'Admin admin', '000000000', 'eng', 1, 'YAHOO', 'matam')

    manager = Manager.get_by_email('*****@*****.**')
    assert manager is not None

    assert Analytics.get_num_rooms_facility_simulation('YAHOO', facility_id=None) == 0
    assert Analytics.get_meetings_number_in_facility_simulation(manager, 'matam') == 0
    assert Analytics.get_all_rooms_occupancy_simulation(manager, 1) == []
    Manager.user_register("*****@*****.**", '123', 'ely', '000000026', 'eng', 3, 'YAHOO', 'matam')
    Manager.user_register("*****@*****.**", '123', 'yosi', '023412349', 'eng', 1, 'YAHOO', 'matam')
    Manager.user_register("*****@*****.**", '123', 'dave', '123412348', 'eng', 1, 'YAHOO', 'matam')
    Manager.user_register("*****@*****.**", '123', 'foox', '000002600', 'eng', 3, 'YAHOO', 'matam')

    Room.add_room(2, 2, 1, 3, 'YAHOO', 'matam', True)
    occupancy_yahoo_matam_1 = Analytics.get_room_occupancy(1, 'YAHOO', time=datetime.now())
    Analytics.get_room_occupancy_simulation(1, "YAHOO", datetime.now())
    status, room_id = Room.add_room(2, 1, 3, 4, 'YAHOO', 'matam', False)
    status, room_id = Room.add_room(2, 1, 5, 4, 'YAHOO', 'matam', True)
    status, room_id = Room.add_room(2, 2, 4, 4, 'YAHOO', 'matam', True)

    assert Analytics.get_num_rooms_facility('YAHOO') == 4

    Room.remove_room(room_id)

    assert Analytics.get_num_rooms_facility('YAHOO') == 3

    Room.add_room(2, 2, 1, 3, 'YAHOO', 'Herzeliya', True)
    Room.add_room(2, 2, 2, 3, 'YAHOO', 'Herzeliya', True)
    Room.add_room(2, 2, 3, 3, 'YAHOO', 'Herzeliya', True)
    Room.add_room(2, 2, 4, 3, 'YAHOO', 'Herzeliya', True)

    assert Analytics.get_num_rooms_facility('YAHOO') == 7
    assert Analytics.get_num_rooms_facility('YAHOO', 'matam') == 3
    assert Analytics.get_num_rooms_facility('YAHOO', 'Herzeliya') == 4

    assert Analytics.get_num_employees_facility('YAHOO') == 5

    Manager.user_register("*****@*****.**", '123', 'avi', '000260000', 'eng', 3, 'YAHOO', 'matam')

    assert Analytics.get_num_employees_facility('YAHOO') == 6

    assert manager.delete_user('*****@*****.**') is True
    assert Analytics.get_num_employees_facility('YAHOO') == 5

    Analytics.get_all_participants_in_facility(manager, 'matam')
    meetings_number_yahoo = Analytics.get_meetings_number_in_facility(manager, "YAHOO")
    # assert meetings_number_yahoo ==
    meetings_number_yahoo = Analytics.get_meeting_number(manager)
    # assert meetings_number_yahoo ==
    room_occupancy_yahoo = Analytics.get_all_rooms_occupancy(manager)
Example #31
0
 def addRoom(self):
     room = Room()
     room.name = "ac12"
     room.capacity = 12
     print Room.add(room)