diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-10-09 15:29:05 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-10-23 14:46:01 +0100 |
commit | 591c90a2ac4ea419a062bf19fffb0831d06786df (patch) | |
tree | 54a6d3245cde45525a9a88fc18ccb73c301eb6ed /templates | |
parent | 97cd4dd5d39ee23a4c8f0863809e4230f954274a (diff) |
Speed up admin front page.
* Don't show a categories summary unless asked via a link
* Don't needlessly join in questionnaire/update summaries
* Switch count(distinct()) to a subselect as it turns out
select count(*) from (select distinct(user_id) from problem) temp;
is a lot quicker than select count(distinct(user_id)) from problem;
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/base/admin/index.html | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/templates/web/base/admin/index.html b/templates/web/base/admin/index.html index 8c49a5685..dde6523a3 100644 --- a/templates/web/base/admin/index.html +++ b/templates/web/base/admin/index.html @@ -55,14 +55,16 @@ and to receive notices of updates. <h2>[% loc('Update breakdown by state') %]</h2> [% PROCESS states object=comments list=comments.keys.sort %] -[% FOREACH category IN categories %] - [% IF loop.first %] - <h2>[% loc('Category fix rate for problems > 4 weeks old') %]</h2> +[% IF categories.size %] + <h2 id="category-fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</h2> <table> <tr><th>[% loc('Category') %]</th><th>[% loc('Total') %]</th><th>[% loc('Fixed') %]</th></tr> - [% END %] +[% FOREACH category IN categories %] <tr><td>[% category.key %]</td><td>[% category.value.total %]</td><td>[% category.value.fixed / category.value.total * 100 | format('%.1f') %]%</td></tr> - [% '</table>' IF loop.last %] +[% END %] + </table> +[% ELSE %] +<p><a href="?show_categories=1#category-fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</a></p> [% END %] [% INCLUDE 'admin/footer.html' %] |