Ejemplo n.º 1
0
    def initialize():
        all_voyages = VoyageLogic.get_all_voyages()

        current_date_and_time = datetime.datetime.now()

        for voyage in all_voyages:
            previous_state_of_voyage = voyage.get_state()

            airplane = voyage.get_airplane()

            employees_in_voyage = voyage.get_pilots() + voyage.get_flight_attendants()

            StateLogic.__update_state_of_voyage(voyage, current_date_and_time)

            state_of_voyage = voyage.get_state()

            if airplane:
                #Update the airplanes state
                StateLogic.__update_state_of_entity(airplane, state_of_voyage)

            #Update the states of all the employees
            for employee in employees_in_voyage:
                StateLogic.__update_state_of_entity(employee, state_of_voyage)


            if previous_state_of_voyage != state_of_voyage:
                DataAPI.change_saved_voyage(voyage, voyage)
                DataAPI.change_saved_airplane(airplane, airplane)
 
                __pilot_count = len(voyage.get_pilots())
                for i, employee in enumerate(employees_in_voyage):
                    if i < __pilot_count:
                        DataAPI.change_saved_pilot(employee,employee)
                    else:
                        DataAPI.change_saved_flight_attendant(employee,employee)
Ejemplo n.º 2
0
 def is_voyage_schedule_start_day_and_time_available(voyage_day_and_time):
     return VoyageLogic.is_voyage_schedule_start_day_and_time_available(voyage_day_and_time)
Ejemplo n.º 3
0
 def get_voyages_by_destination(destination):
     return VoyageLogic.get_voyages_by_destination(destination)
Ejemplo n.º 4
0
 def get_airplane_voyages(airplane):
     return VoyageLogic.get_airplane_voyages(airplane)
Ejemplo n.º 5
0
    def get_voyages_by_date(date):

        return VoyageLogic.get_voyages_by_date(date)
Ejemplo n.º 6
0
 def get_voyages_by_week(week):
     return VoyageLogic.get_voyages_by_week(week)
Ejemplo n.º 7
0
 def get_completed_voyages():#needs testing
     return VoyageLogic.get_completed_voyages()
Ejemplo n.º 8
0
 def get_ongoing_voyages():
     return VoyageLogic.get_ongoing_voyages()
Ejemplo n.º 9
0
 def change_saved_voyage(saved_voyage, changed_voyage):
     VoyageLogic.change_saved_voyage(saved_voyage, changed_voyage)
Ejemplo n.º 10
0
 def get_all_voyages():
     return VoyageLogic.get_all_voyages()
Ejemplo n.º 11
0
 def save_new_voyage(voyage):
     VoyageLogic.save_new_voyage(voyage)