mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Question detail view: Show total number of answers
This commit is contained in:
@@ -84,6 +84,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td><strong>{% trans "Sum" %}</strong></td>
|
||||||
|
<td class="text-right"><strong>{{ total }}</strong></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -717,13 +717,13 @@ class QuestionView(EventPermissionRequiredMixin, QuestionMixin, ChartContainingV
|
|||||||
total = sum(a['count'] for a in r)
|
total = sum(a['count'] for a in r)
|
||||||
for a in r:
|
for a in r:
|
||||||
a['percentage'] = (a['count'] / total * 100.) if total else 0
|
a['percentage'] = (a['count'] / total * 100.) if total else 0
|
||||||
return r
|
return r, total
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
ctx = super().get_context_data()
|
ctx = super().get_context_data()
|
||||||
ctx['items'] = self.object.items.all()
|
ctx['items'] = self.object.items.all()
|
||||||
stats = self.get_answer_statistics()
|
stats = self.get_answer_statistics()
|
||||||
ctx['stats'] = stats
|
ctx['stats'], ctx['total'] = stats
|
||||||
ctx['stats_json'] = json.dumps(stats)
|
ctx['stats_json'] = json.dumps(stats)
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user