Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions assopy/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ def _calc_prices(order_id, items):
if price not in tcp[code]['prices']:
tcp[code]['prices'][price] = { 'price': price, 'count': 0 }
tcp[code]['prices'][price]['count'] += 1
return tcp.values()
# Replace prices dicts with sorted lists
for code in tcp.keys():
prices_list = [entry
for price, entry in sorted(tcp[code]['prices'].items())]
tcp[code]['prices'] = prices_list
# Create list sorted by fare code
ticket_sales = [entry for code, entry in sorted(tcp.items())]
return ticket_sales
prezzo_biglietti_ricalcolato.template = '''
<table>
<tr>
Expand All @@ -199,7 +206,7 @@ def _calc_prices(order_id, items):
<th style="width: 70px;">Price</th>
</tr>
{% for ticket in data %}
{% for p in ticket.prices.values %}
{% for p in ticket.prices %}
<tr>
{% if forloop.counter == 1 %}
<td title="{{ ticket.name }}" rowspan="{{ ticket.prices|length }}">{{ ticket.code }}</td>
Expand Down