From ecc7dcdc1729c0340174e2dd5651fce6d192df1b Mon Sep 17 00:00:00 2001 From: Benbb96 Date: Thu, 8 Oct 2020 00:48:03 +0200 Subject: [PATCH] Fix tests --- helpdesk/templates/helpdesk/report_output.html | 8 ++++++-- helpdesk/views/staff.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/helpdesk/templates/helpdesk/report_output.html b/helpdesk/templates/helpdesk/report_output.html index ea6e2fe6..5bbc81ca 100644 --- a/helpdesk/templates/helpdesk/report_output.html +++ b/helpdesk/templates/helpdesk/report_output.html @@ -75,6 +75,10 @@ {% for d in data %} {% for f in d %}{{ f }}{% endfor %} {% endfor %} + {# Total row #} + + {% for f in total_data %}{{ f }}{% endfor %} + @@ -96,7 +100,7 @@ Morris.Line({ element: 'chart-content', data: {% autoescape on %}{{ morrisjs_data|safe }}{% endautoescape %}, xkey: 'x', - ykeys: [{% for d in data|slice:":-1" %}{{ forloop.counter0 }}{% if not forloop.last %}, {% endif %}{% endfor %}], + ykeys: [{% for d in data %}{{ forloop.counter0 }}{% if not forloop.last %}, {% endif %}{% endfor %}], labels: [{% for n in series_names %}"{{ n }}"{% if not forloop.last %}, {% endif %}{% endfor %}], xLabels: "month" }); @@ -110,7 +114,7 @@ Morris.Bar({ element: 'chart-content', data: {% autoescape on %}{{ morrisjs_data|safe }}{% endautoescape %}, xkey: 'x', - ykeys: [{% for d in data|slice:":-1" %}{{ forloop.counter0 }}{% if not forloop.last %}, {% endif %}{% endfor %}], + ykeys: [{% for d in data %}{{ forloop.counter0 }}{% if not forloop.last %}, {% endif %}{% endfor %}], labels: [{% for n in series_names %}"{{ n }}"{% if not forloop.last %}, {% endif %}{% endfor %}] }); diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 02c21580..292c3d30 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -1339,15 +1339,15 @@ def run_report(request, report): series_names.append(series[0]) # Add total row to table - total_data = [] + total_data = ['Total'] for hdr in possible_options: total_data.append(str(totals[hdr])) - table.append(['Total'] + total_data) return render(request, 'helpdesk/report_output.html', { 'title': title, 'charttype': charttype, 'data': table, + 'total_data': total_data, 'headings': column_headings, 'series_names': series_names, 'morrisjs_data': morrisjs_data,