Esempio n. 1
0
    def new_order_simulation(self, date, participants, start_time, end_time,
                             company, facility):
        if self.email not in participants:
            participants.append(self.email)
        problematic_participants = Schedule.all_participants_are_free_simulation(
            date, participants, start_time, end_time)

        if len(problematic_participants) > 0:
            return False, problematic_participants
        min_permission = User.min_permission_simulation(participants)
        _id = self.email + ' ' + date + ' ' + str(start_time) + ' ' + str(
            end_time)
        status, order_id, room_id = Order.new_order_simulation(
            _id, self.email, date, participants, start_time, end_time, company,
            facility, min_permission)

        if status:
            # not finish yet
            Schedule.assign_all_simulation(date, participants, start_time,
                                           end_time, order_id, room_id)
            # self.create_meeting(start_time, end_time, order_id, room_id, date, participants)
        return status, order_id
Esempio n. 2
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