summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/views.py
diff options
context:
space:
mode:
authorMagnus Hagander2015-02-07 12:31:59 +0000
committerMagnus Hagander2015-02-07 12:31:59 +0000
commit2bf6b909fd42f09ada9667264b9a0300f15503d9 (patch)
tree57c43a29d428f04b685081fdfe8e25063a0d1c16 /pgcommitfest/commitfest/views.py
parentd251d24f6e0d94871334deb070643f2b47caa918 (diff)
Add status summary to top of each commitfest list
Quick overview of how many patches are in each status, as exist on the old app.
Diffstat (limited to 'pgcommitfest/commitfest/views.py')
-rw-r--r--pgcommitfest/commitfest/views.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index ab622c9..55302d9 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -147,6 +147,14 @@ def commitfest(request, cfid):
'is_open':'commitfest_patchoncommitfest.status IN (%s)' % ','.join([str(x) for x in PatchOnCommitFest.OPEN_STATUSES]),
}).order_by(*ordering))
+ # Generate patch status summary.
+ curs = connection.cursor()
+ curs.execute("SELECT ps.status, ps.statusstring, count(*) FROM commitfest_patchoncommitfest poc INNER JOIN commitfest_patchstatus ps ON ps.status=poc.status WHERE commitfest_id=%(id)s GROUP BY ps.status ORDER BY ps.sortkey", {
+ 'id': cf.id,
+ })
+ statussummary = curs.fetchall()
+ statussummary.append([-1, 'Total', sum((r[2] for r in statussummary))])
+
# Generates a fairly expensive query, which we shouldn't do unless
# the user is logged in. XXX: Figure out how to avoid doing that..
form = CommitFestFilterForm(cf, request.GET)
@@ -155,6 +163,7 @@ def commitfest(request, cfid):
'cf': cf,
'form': form,
'patches': patches,
+ 'statussummary': statussummary,
'has_filter': has_filter,
'title': cf.title,
'grouping': sortkey==0,