diff --git a/src/orders/delivery/delivery_modules/processors/delivery_helpers.py b/src/orders/delivery/delivery_modules/processors/delivery_helpers.py index f87980d..0afa4f2 100644 --- a/src/orders/delivery/delivery_modules/processors/delivery_helpers.py +++ b/src/orders/delivery/delivery_modules/processors/delivery_helpers.py @@ -17,11 +17,11 @@ def process_records_for_driver(self, driver_number, orders_for_today, dao): logger.info(f"Processing records for driver {driver_number}") morning_records = processor.select_orders_by_delivery_range_time( order_records=orders_for_today, - delivery_time_to_match="8 AM - 1 PM", + delivery_time_to_match="9 AM - 1 PM", driver_to_match=driver_number ) if len(morning_records) > 0: - logger.info(f"Records to schedule for 8 AM - 1 PM delivery for Driver {driver_number}: {len(morning_records)}") + logger.info(f"Records to schedule for 9 AM - 1 PM delivery for Driver {driver_number}: {len(morning_records)}") morning_starting_point = { "latitude": 20.7257943, "longitude": -103.3792193, diff --git a/src/orders/integration/data_mapper.py b/src/orders/integration/data_mapper.py index 6d57526..ae1c713 100644 --- a/src/orders/integration/data_mapper.py +++ b/src/orders/integration/data_mapper.py @@ -137,6 +137,9 @@ def map_order_data(self) -> dict: self._check_order_is_allowed() delivery_time = self._get_note_value("Order Due Time") + if delivery_time is None or delivery_time == '8 AM - 1 PM': + delivery_time = '9 AM - 1 PM' + geolocation = { "latitude": self._get_coordinate("latitude"), "longitude": self._get_coordinate("longitude"), diff --git a/src/orders/order_modules/utils/delivery.py b/src/orders/order_modules/utils/delivery.py index 9c51286..c8f54e3 100644 --- a/src/orders/order_modules/utils/delivery.py +++ b/src/orders/order_modules/utils/delivery.py @@ -8,7 +8,7 @@ class DeliveryScheduler: - MORNING_DELIVERIES = "8 AM - 1 PM" + MORNING_DELIVERIES = "9 AM - 1 PM" AFTERNOON_DELIVERIES = "1 PM - 5 PM" AT_CAPACITY = 0 INVALID_SECTOR = 0 @@ -148,7 +148,7 @@ def assign_driver_for_delivery( Arguments: customer_location -- Geolocation data, lat and long - delivery_time -- Options can be '8 AM - 1 PM' or '1 PM - 5 PM' + delivery_time -- Options can be '9 AM - 1 PM' or '1 PM - 5 PM' order_date -- string date with format YYYY-MM-DD orders -- list of orders for specific date, this will help us to check capacity source -- OrderSource Enum. Used to give priority to Shopify orders. @@ -160,11 +160,11 @@ def assign_driver_for_delivery( Notes: Sector-Based Delivery Preferences for HiberryApp orders: - West Sectors (1 and 2): - - Deliveries are preferred on Mondays, Wednesdays, and Fridays (days 0, 2, 4) during the morning (8 AM - 1 PM). + - Deliveries are preferred on Mondays, Wednesdays, and Fridays (days 0, 2, 4) during the morning (9 AM - 1 PM). - Deliveries are preferred on Tuesdays, Thursdays, and Saturdays (days 1, 3, 5) during the afternoon (1 PM - 5 PM). - East Sectors (3 and 4): - Deliveries are preferred on Mondays, Wednesdays, and Fridays (days 0, 2, 4) during the afternoon (1 PM - 5 PM). - - Deliveries are preferred on Tuesdays, Thursdays, and Saturdays (days 1, 3, 5) during the morning (8 AM - 1 PM). + - Deliveries are preferred on Tuesdays, Thursdays, and Saturdays (days 1, 3, 5) during the morning (9 AM - 1 PM). """ day_of_week = self._get_day_of_week(order_date) customer_sector = self._get_customer_sector(customer_location) diff --git a/tests/deliveries/test_delivery_scheduler.py b/tests/deliveries/test_delivery_scheduler.py index 69f27be..06d0acf 100644 --- a/tests/deliveries/test_delivery_scheduler.py +++ b/tests/deliveries/test_delivery_scheduler.py @@ -12,7 +12,7 @@ def setUp(self): self.southeast_location = (20.595247, -103.315226) self.monday = "2024-01-08" self.tuesday = "2024-01-09" - self.morning_time = "8 AM - 1 PM" + self.morning_time = "9 AM - 1 PM" self.afternoon_time = "1 PM - 5 PM" def test_give_a_request_for_northwest_sector_for_the_morning_route_on_a_monday_order_will_be_created( diff --git a/tests/integration/test_shopify_data_mapper.py b/tests/integration/test_shopify_data_mapper.py index 893548e..82d0fec 100644 --- a/tests/integration/test_shopify_data_mapper.py +++ b/tests/integration/test_shopify_data_mapper.py @@ -114,7 +114,7 @@ def test_map_order_data(self): "delivery_address": "123 Happy St", "geolocation": {"latitude": 20.0,"longitude": -105.0}, "delivery_date": "2023-12-20", - "delivery_time": "8 AM - 1 PM", + "delivery_time": "9 AM - 1 PM", "cart_items": [{"product": "Product 1", "price": 100.0 ,"quantity": 2}], "total_amount": 200.0, "payment_method": 'PAID',