Fixes GH-54: Stats crash without open tickets. This should have already been caught, so this patch fixes it and adds another sanity check at report runtime.

This commit is contained in:
Ross Poulton 2011-04-19 21:36:20 +00:00
parent 701d742840
commit 5278634a76
2 changed files with 3 additions and 1 deletions

View File

@ -3,7 +3,7 @@
{% block helpdesk_title %}{% trans "Reports & Statistics" %}{% endblock %}
{% block helpdesk_body %}
{% ifequal num_tickets 0 %}{% blocktrans %}
{% ifequal number_tickets 0 %}{% blocktrans %}
<h2>Reports &amp; Statistics</h2>
<p>You haven't created any tickets yet, so you cannot run any reports.</p>

View File

@ -751,6 +751,8 @@ report_index = staff_member_required(report_index)
def run_report(request, report):
if Ticket.objects.all().count() == 0:
return HttpResponseRedirect(reverse("helpdesk_report_index"))
priority_sql = []
priority_columns = []
for p in Ticket.PRIORITY_CHOICES: