forked from CGM_Public/pretix_original
Fix #972 -- Clarify sum in quota detail
This commit is contained in:
@@ -39,16 +39,18 @@
|
||||
</div>
|
||||
{% for row in quota_table_rows %}
|
||||
<div class="row">
|
||||
<div class="col-xs-9">{{ row.label }}</div>
|
||||
<div class="col-xs-3 text-right"> – {{ row.value }}</div>
|
||||
<div class="col-xs-9">
|
||||
{% if row.strong %}<strong>{% endif %}
|
||||
{{ row.label }}
|
||||
{% if row.strong %}</strong>{% endif %}
|
||||
</div>
|
||||
<div class="col-xs-3 text-right">
|
||||
{% if row.strong %}<strong>{% endif %}
|
||||
{% if not row.strong %}–{% endif %} {{ row.value }}
|
||||
{% if row.strong %}</strong>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="col-xs-9"><strong>{% trans "Current availability" %}</strong></div>
|
||||
<div class="col-xs-3 text-right">
|
||||
{% if quota.size == None %}{% trans "Infinite" %}{% else %}{{ avail.1 }}{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if quota_overbooked > 0 %}
|
||||
<div class="alert alert-warning">
|
||||
{% blocktrans trimmed with num=quota_overbooked %}
|
||||
|
||||
@@ -622,23 +622,33 @@ class QuotaView(ChartContainingView, DetailView):
|
||||
'value': self.object.count_in_cart(),
|
||||
'sum': True,
|
||||
},
|
||||
{
|
||||
'label': ugettext('Waiting list (pending)'),
|
||||
'value': self.object.count_waiting_list_pending(),
|
||||
'sum': False,
|
||||
},
|
||||
]
|
||||
ctx['quota_table_rows'] = list(data)
|
||||
|
||||
sum_values = sum([d['value'] for d in data if d['sum']])
|
||||
s = self.object.size - sum_values if self.object.size is not None else 0
|
||||
|
||||
data.append({
|
||||
'label': ugettext('Available quota'),
|
||||
'value': s,
|
||||
'sum': False,
|
||||
'strong': True
|
||||
})
|
||||
data.append({
|
||||
'label': ugettext('Waiting list (pending)'),
|
||||
'value': self.object.count_waiting_list_pending(),
|
||||
'sum': False,
|
||||
})
|
||||
|
||||
if self.object.size is not None:
|
||||
data.append({
|
||||
'label': ugettext('Current availability'),
|
||||
'value': avail[1]
|
||||
'label': ugettext('Currently for sale'),
|
||||
'value': avail[1],
|
||||
'sum': False,
|
||||
'strong': True
|
||||
})
|
||||
|
||||
ctx['quota_chart_data'] = json.dumps(data)
|
||||
ctx['quota_chart_data'] = json.dumps([r for r in data if r.get('sum')])
|
||||
ctx['quota_table_rows'] = list(data)
|
||||
ctx['quota_overbooked'] = sum_values - self.object.size if self.object.size is not None else 0
|
||||
|
||||
ctx['has_ignore_vouchers'] = Voucher.objects.filter(
|
||||
|
||||
Reference in New Issue
Block a user