diff --git a/setup.py b/setup.py index a0d95576..0f112e04 100644 --- a/setup.py +++ b/setup.py @@ -5,14 +5,14 @@ setuptools.setup( name="souschef", - version="1.3.8dev2", + version="1.3.8dev3", license="AGPL-3.0", author="Santropol Roulant and Savoir Faire Linux", author_email="info@santropolroulant.org", description="Webapp used to manage orders for meals-on-wheel delivery", long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/pypa/sous-chef", + url="https://github.com/santropolroulant/sous-chef", packages=setuptools.find_packages(), include_package_data=True, classifiers=[ diff --git a/souschef/delivery/views.py b/souschef/delivery/views.py index 7c309466..5f2f211d 100755 --- a/souschef/delivery/views.py +++ b/souschef/delivery/views.py @@ -384,7 +384,7 @@ def get(self, request, *args, **kwargs): all_configured = True for route in routes: clients = Order.objects.get_shippable_orders_by_route( - route.id, exclude_non_geolocalized=True + route.id, delivery_date, exclude_non_geolocalized=True ).values_list("client__pk", flat=True) order_count = len(clients) try: @@ -470,7 +470,7 @@ def post(self, request, pk, *args, **kwargs): delivery_date = date.fromisoformat(request.POST["delivery_date"]) route = get_object_or_404(Route, pk=pk) if not Order.objects.get_shippable_orders_by_route( - route.id, exclude_non_geolocalized=True + route.id, delivery_date, exclude_non_geolocalized=True ).exists(): # No clients on this route. raise Http404 diff --git a/souschef/member/views.py b/souschef/member/views.py index 91499617..64376b6c 100644 --- a/souschef/member/views.py +++ b/souschef/member/views.py @@ -101,9 +101,7 @@ def dispatch(self, request, *args, **kwargs): non_i18n_step = i18n_step finally: kwargs["step"] = non_i18n_step - return super().dispatch( - request, *args, **kwargs - ) + return super().dispatch(request, *args, **kwargs) def get_step_url(self, step): """ @@ -952,9 +950,7 @@ class ClientUpdateRelationshipsInformation(ClientUpdateInformation): prefix = "relationships" def get_context_data(self, **kwargs): - context = super().get_context_data( - **kwargs - ) + context = super().get_context_data(**kwargs) context.update({"current_step": "relationships"}) context.update({"pk": self.kwargs["pk"]}) context["step_template"] = "client/partials/forms/" "relationships.html" @@ -1355,7 +1351,7 @@ def get_clients_on_delivery_history(delivery_history, func_add_warning_message=N """ orders = Order.objects.get_shippable_orders_by_route( delivery_history.route.pk, - delivery_date=delivery_history.date, + delivery_history.date, exclude_non_geolocalized=True, ).select_related("client", "client__member", "client__member__address") clients = [] diff --git a/souschef/order/models.py b/souschef/order/models.py index a3749380..1fec8146 100644 --- a/souschef/order/models.py +++ b/souschef/order/models.py @@ -102,7 +102,7 @@ def get_shippable_orders(self, delivery_date=None, exclude_non_geolocalized=Fals ) def get_shippable_orders_by_route( - self, route_id, delivery_date=None, exclude_non_geolocalized=False + self, route_id, delivery_date, exclude_non_geolocalized=False ): """ Return the orders ready to be delivered for a given route. diff --git a/souschef/order/tests.py b/souschef/order/tests.py index 577dced3..d7a4834b 100644 --- a/souschef/order/tests.py +++ b/souschef/order/tests.py @@ -98,7 +98,9 @@ def test_get_shippable_orders_by_route(self): A shippable order must be created in the database, and its ORDER_STATUS must be 'O' (Ordered). """ - orders = Order.objects.get_shippable_orders_by_route(self.route.id) + orders = Order.objects.get_shippable_orders_by_route( + self.route.id, date.today() + ) self.assertEqual( len(orders), len(self.orders) + len(self.paused_orders),