Beispiel #1
0
 def result(self):
     # delivery
     if self.user_selection.lower() == 'd':
         if len(self.shift.deliveries) == 1:
             View_Delivery_Menu(self.shift.deliveries[0])
             self.loop_condition = False
         elif len(self.shift.deliveries) > 1:
             from processes.select import Select_Delivery
             select_delivery = Select_Delivery(self.shift)
             delivery_index = select_delivery.get_index()
             if isinstance(delivery_index, int):
                 delivery = self.shift.deliveries[delivery_index]
                 View_Delivery_Menu(delivery)
     # extra stop
     elif self.user_selection.lower() == 'e':
         from processes.view import view_extra_stop
         # 1 extra stop
         if len(self.shift.extra_stops) == 1:
             # display extra stop to user
             print(view_extra_stop(self.shift.extra_stops[0]))
             self.loop_condition = False
         # more then 1 extra stop
         elif len(self.shift.extra_stops) > 1:
             from processes.select import Select_Extra_Stop
             # user select extra stop
             select_extra_stop = Select_Extra_Stop(self.shift)
             # get index
             extra_stop_index = select_extra_stop.get_index()
             # display extra stop to user
             if isinstance(extra_stop_index, int):
                 extra_stop = self.shift.extra_stops[extra_stop_index]
                 print(view_extra_stop(extra_stop))
     # split
     elif self.user_selection.lower() == 's':
         from processes.view import view_split
         print(view_split(self.shift.split))
     # carry out tip
     elif self.user_selection.lower() == 't':
         from processes.view import view_tip
         if len(self.shift.carry_out_tips) == 1:
             print(view_tip(self.shift.carry_out_tips[0]))
         elif len(self.shift.carry_out_tips) > 1:
             from processes.select import Select_Carry_Out_Tip
             select_tip = Select_Carry_Out_Tip(self.shift)
             tip_index = select_tip.get_index()
             if isinstance(tip_index, int):
                 print(view_tip(self.shift.carry_out_tips[tip_index]))
     # back
     elif self.user_selection.lower() == 'b':
         self.loop_condition = False
    def result(self):
        # location
        if self.user_selection == '1':
            self.extra_stop.change_location()
        # reason
        elif self.user_selection == '2':
            self.extra_stop.change_reason()
        # distance
        elif self.user_selection == '3':
            self.extra_stop.change_distance()
        # end time
        elif self.user_selection == '4':
            self.extra_stop.change_end_time()
        # start time
        elif self.user_selection == '5':
            self.extra_stop.change_start_time()
        # view
        elif self.user_selection.lower() == 'v':
            from processes.view import view_extra_stop
            print(view_extra_stop(self.extra_stop))
        # back
        elif self.user_selection.lower() == 'b':
            self.loop_condition = False

        if self.extra_stop.collection() != self.original_extra_stop.collection(
        ):
            self.changed = True
Beispiel #3
0
 def result(self):
     # orders
     if self.user_selection.lower() == 'o':
         from processes.view import view_order
         # 1 order
         if len(self.delivery.orders) == 1:
             from utility.utility import add_newlines
             print(add_newlines(view_order(self.delivery.orders[0])))
             self.loop_condition = False
         # more then 1 order
         elif len(self.delivery.orders) > 1:
             from processes.select import Select_Order
             select_order = Select_Order(self.delivery)
             order_index = select_order.get_index()
             if isinstance(order_index, int):
                 print(view_order(self.delivery.orders[order_index]))
     # extra stops
     elif self.user_selection.lower() == 'e':
         from processes.view import view_extra_stop
         # 1 extra stop
         if len(self.delivery.extra_stops) == 1:
             # display extra stop to user
             print(view_extra_stop(self.delivery.extra_stops[0]))
             self.loop_condition = False
         # more then 1 extra stop
         elif len(self.delivery.extra_stops) > 1:
             from processes.select import Select_Extra_Stop
             # user select extra stop
             select_extra_stop = Select_Extra_Stop(self.delivery)
             # get index
             extra_stop_index = select_extra_stop.get_index()
             if isinstance(extra_stop_index, int):
                 extra_stop = self.delivery.extra_stops[extra_stop_index]
                 # display extra stop to user
                 print(view_extra_stop(extra_stop))
     # back
     elif self.user_selection.lower() == 'b':
         self.loop_condition = False
Beispiel #4
0
    def test_view_extra_stop_delivery(self):
        from processes.view import view_extra_stop

        shift = completed_shift()
        extra_stop = shift.deliveries[1].extra_stops[0]
        test = view_extra_stop(extra_stop)

        expected =\
            f'Extra stop id #: {extra_stop.id + 1}\n'\
            f'\tExtra stop was completed at: {extra_stop.end_time.strftime("%I:%M:%S %p")}\n'\
            f'\tLocation: {extra_stop.location.capitalize()}\n'\
            f'\tReason: {extra_stop.reason.capitalize()}\n'\
            f'\tDistance to extra stop: {extra_stop.miles_traveled} miles\n'

        self.assertEqual(test, expected)