Remove pills introduced in previous commit

This commit is contained in:
Midgard 2021-06-21 02:08:32 +02:00
parent 16bd9243d4
commit e82742eb62
Signed by: midgard
GPG key ID: 511C112F1331BBB4
3 changed files with 6 additions and 12 deletions

View file

@ -71,7 +71,7 @@ class Order(db.Model):
return list(sorted(group.items(), key=lambda t: (t[0] or "", t[1] or ""))) return list(sorted(group.items(), key=lambda t: (t[0] or "", t[1] or "")))
def group_by_dish(self) \ def group_by_dish(self) \
-> typing.List[typing.Tuple[str, int, typing.List[typing.Tuple[typing.List[str], typing.List]]]]: -> typing.List[typing.Tuple[str, int, typing.List[typing.Tuple[str, typing.List]]]]:
"Group items of an Order by dish" "Group items of an Order by dish"
group: typing.Dict[str, typing.Dict[str, typing.List]] = \ group: typing.Dict[str, typing.Dict[str, typing.List]] = \
defaultdict(lambda: defaultdict(list)) defaultdict(lambda: defaultdict(list))
@ -85,10 +85,7 @@ class Order(db.Model):
# Amount of items of this dish # Amount of items of this dish
sum(map(len, comment_group.values())), sum(map(len, comment_group.values())),
sorted( sorted(
( (comment, sorted(items, key=lambda x: (x.for_name or "")))
(list(map(str.strip, comment.split(";"))) if comment else []),
sorted(items, key=lambda x: (x.for_name or ""))
)
for comment, items in comment_group.items() for comment, items in comment_group.items()
) )
) )

View file

@ -241,10 +241,9 @@
{% if has_comments -%} {% if has_comments -%}
<ul class="comments"> <ul class="comments">
{% for comment, items in dish_comment_groups -%} {% for comment, items in dish_comment_groups -%}
<li class="spacecake"><span class="comment"><span class="quantity">{{ items | length }}</span> × <li class="spacecake"><span class="comment">
{% if comment %} <span class="quantity">{{ items | length }}</span> ×
{% set semicolon = joiner(";") %} {% if comment %}{{ comment }}
{% for comment_part in comment %}<span class="comment_part_separator">{{ semicolon() }} </span><span class="comment_part">{{ comment_part }}</span>{% endfor %}
{% else %}<i>No comment</i> {% else %}<i>No comment</i>
{% endif %}</span><span class="spacer"> </span><span class="item_for">for {{ items | map(attribute="for_name") | join(", ") }}</span></li> {% endif %}</span><span class="spacer"> </span><span class="item_for">for {{ items | map(attribute="for_name") | join(", ") }}</span></li>
{% endfor %} {% endfor %}

View file

@ -38,9 +38,7 @@ Haldis - Order {{ order.id }}
<ul class="comments"> <ul class="comments">
{% for comment, items in dish_comment_groups -%} {% for comment, items in dish_comment_groups -%}
<li><span class="quantity">{{ items | length }}</span> × <li><span class="quantity">{{ items | length }}</span> ×
{% if comment %} {% if comment %}{{ comment }}
{% set semicolon = joiner(";") %}
{% for comment_part in comment %}<span class="comment_part_separator">{{ semicolon() }} </span><span class="comment_part">{{ comment_part }}</span>{% endfor %}
{% else %}<i>No comment</i> {% else %}<i>No comment</i>
{% endif %}</li> {% endif %}</li>
{% endfor %} {% endfor %}