diff --git a/la_chariotte/order/templates/order/grouped_order_detail.html b/la_chariotte/order/templates/order/grouped_order_detail.html index 48e66ca..0632781 100644 --- a/la_chariotte/order/templates/order/grouped_order_detail.html +++ b/la_chariotte/order/templates/order/grouped_order_detail.html @@ -138,15 +138,15 @@
-
+-
+-
+-
+@@ -170,13 +170,13 @@ function findTotal(){ var inputs = document.getElementsByTagName("input"); total_price = 0; - for (x = 0 ; x < inputs.length ; x++){ - input_name = inputs[x].getAttribute("name"); + for(let input of inputs){ + input_name = input.getAttribute("name"); if(input_name.indexOf("quantity_")==0){ // get the quantities inputs only item_id = input_name.split("_")[1]; prices = {{ prices_dict | safe }}; - total_price += prices[item_id] * inputs[x].value; - console.log(prices[item_id] * inputs[x].value); + total_price += prices[item_id] * input.value; + console.log(prices[item_id] * input.value); } } console.log(total_price); diff --git a/la_chariotte/order/templates/order/grouped_order_overview.html b/la_chariotte/order/templates/order/grouped_order_overview.html index 320267a..6f11842 100644 --- a/la_chariotte/order/templates/order/grouped_order_overview.html +++ b/la_chariotte/order/templates/order/grouped_order_overview.html @@ -182,7 +182,7 @@
Votre commande
Prix total de la commande : {{ order.price }} €
diff --git a/la_chariotte/order/tests/test_views/test_views_grouped_order.py b/la_chariotte/order/tests/test_views/test_views_grouped_order.py
index ad1eed7..e6e6bed 100644
--- a/la_chariotte/order/tests/test_views/test_views_grouped_order.py
+++ b/la_chariotte/order/tests/test_views/test_views_grouped_order.py
@@ -258,14 +258,15 @@ class TestGroupedOrderDetailView:
)
item.refresh_from_db()
item2.refresh_from_db()
- assert models.OrderAuthor.objects.first().first_name == "Prénom"
- assert models.OrderAuthor.objects.first().email == "test@mail.fr"
- assert models.OrderAuthor.objects.first().phone == "0645632569"
- assert models.Order.objects.first().note == "note test"
- assert models.Order.objects.first().created_date.date() == timezone.now().date()
+ author = models.OrderAuthor.objects.first()
+ order = models.Order.objects.first()
+ assert author.first_name == "Prénom"
+ assert author.email == "test@mail.fr"
+ assert author.phone == "0645632569"
+ assert order.note == "note test"
+ assert order.created_date.date() == timezone.now().date()
assert item.ordered_nb == 4
assert item2.ordered_nb == 1
- order = models.Order.objects.first()
assert order.ordered_items.count() == 2
assert order.articles_nb == 5
assert order.price == 9
@@ -321,12 +322,13 @@ class TestGroupedOrderDetailView:
response.context["error_message"]
== "Veuillez commander au moins un produit"
)
- assert response.context["first_name"] == "Prénom test"
- assert "Prénom test" in response.content.decode()
- assert "Nom test" in response.content.decode()
- assert "0645632569" in response.content.decode()
- assert "test@mail.fr" in response.content.decode()
- assert "test note" in response.content.decode()
+ assert response.context["author"].first_name == "Prénom test"
+ content = response.content.decode()
+ assert "Prénom test" in content
+ assert "Nom test" in content
+ assert "0645632569" in content
+ assert "test@mail.fr" in content
+ assert "test note" in content
assert not models.Order.objects.first()
assert not models.OrderAuthor.objects.first()
diff --git a/la_chariotte/order/tests/test_views/test_views_order.py b/la_chariotte/order/tests/test_views/test_views_order.py
index 0bde19a..38e4d38 100644
--- a/la_chariotte/order/tests/test_views/test_views_order.py
+++ b/la_chariotte/order/tests/test_views/test_views_order.py
@@ -15,7 +15,7 @@ pytestmark = pytest.mark.django_db
class TestOrder:
- def test_order_deadline_passed(self, client, other_user):
+ def test_order_deadline_passed__raise_errors(self, client, other_user):
"""A user orders when the deadline is passed. They get a 403 error"""
grouped_order = create_grouped_order(
days_before_delivery_date=5,
@@ -47,7 +47,7 @@ class TestOrder:
)
assert response.status_code == 403
- def test_order_deadline_passed__orga(self, client_log):
+ def test_order_deadline_passed__still_works_for_orga(self, client_log):
"""The orga user orders when the deadline is passed, but the delivery is to come. It works"""
grouped_order = create_grouped_order(
diff --git a/la_chariotte/order/urls.py b/la_chariotte/order/urls.py
index 44c6971..dc1706e 100644
--- a/la_chariotte/order/urls.py
+++ b/la_chariotte/order/urls.py
@@ -13,7 +13,7 @@ urlpatterns = [
views.GroupedOrderOverview.as_view(),
name="grouped_order_overview",
),
- path("