Make discount heading even smaller

This commit is contained in:
Tobias 2018-09-30 18:58:47 +13:00
parent 357fe894dd
commit 2db0d95426
2 changed files with 9 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{% if discounts %} {% if discounts %}
<div class="my-4 py-4 px-4 bg-primary text-secondary"> <div class="my-4 py-4 px-4 bg-primary text-secondary">
<h2>Discounts and Complimentary Items</h2> <h4>Discounts and Complimentary Items</h4>
<p>The following discounts and complimentary items are available to you. If you wish to take advantage of this offer, you must choose your items below. The discounts will be applied automatically when you check out.</p> <p>The following discounts and complimentary items are available to you. If you wish to take advantage of this offer, you must choose your items below. The discounts will be applied automatically when you check out.</p>
{% regroup discounts by discount.description as discounts_grouped %} {% regroup discounts by discount.description as discounts_grouped %}
{% for discount_type in discounts_grouped %} {% for discount_type in discounts_grouped %}

View file

@ -1,3 +1,4 @@
from collections import defaultdict
import datetime import datetime
import zipfile import zipfile
import os import os
@ -291,21 +292,22 @@ def _guided_registration_products(request, mode):
seen_categories = [] seen_categories = []
with BatchController.batch(request.user): with BatchController.batch(request.user):
available_products = list(ProductController.available_products( available_products = ProductController.available_products(
request.user, request.user,
products=all_products, products=all_products,
)) )
if len(available_products) == 0: if len(available_products) == 0:
return [] return []
available_by_category = defaultdict(list)
for product in available_products:
available_by_category[product.category].append(product)
has_errors = False has_errors = False
for category in cats: for category in cats:
products = [ products = available_by_category[category]
i for i in available_products
if i.category == category
]
prefix = "category_" + str(category.id) prefix = "category_" + str(category.id)
p = _handle_products(request, category, products, prefix) p = _handle_products(request, category, products, prefix)