From bff99c3de72f8e87f8d726a4f7e00b7e6fdb4661 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 21 Jul 2009 22:12:19 -0400 Subject: [PATCH] Show status summary on commitfest view page. --- perl-lib/PgCommitFest/CommitFest.pm | 15 +++++++++++++-- template/commitfest_view.tt2 | 8 ++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/perl-lib/PgCommitFest/CommitFest.pm b/perl-lib/PgCommitFest/CommitFest.pm index 84cee1f..6955839 100644 --- a/perl-lib/PgCommitFest/CommitFest.pm +++ b/perl-lib/PgCommitFest/CommitFest.pm @@ -191,7 +191,13 @@ EOM unshift @{$p->{'comment_list'}}, $c; } - # Add links and render template. + # Load status counts. + my $status_count_list = $r->db->select(<{'id'}); +SELECT patch_status_id, patch_status, sum(1) AS num_patches from patch_view + WHERE commitfest_id = ? GROUP BY 1, 2 ORDER BY 1 +EOM + + # Add links. $r->add_link('/action/patch_form?commitfest=' . $id, 'New Patch'); $r->add_link('/action/commitfest_activity?id=' . $id, 'Activity Log'); $r->add_link('/action/commitfest_topic_search?id=' . $id, @@ -202,7 +208,12 @@ EOM 'Delete CommitFest', 'Are you sure you want to delete this CommitFest?'); } - $r->render_template('commitfest_view', { 'd' => $d, 'patch_grouping' => [ + + # Render template. + $r->render_template('commitfest_view', { + 'd' => $d, 'status_count_list' => $status_count_list, + 'total_count' => 0+@$patch_list, + 'patch_grouping' => [ { 'name' => 'Pending Patches', 'patch_list' => $patch_grouping{'p'}, diff --git a/template/commitfest_view.tt2 b/template/commitfest_view.tt2 index 7bb6296..5e4db85 100644 --- a/template/commitfest_view.tt2 +++ b/template/commitfest_view.tt2 @@ -2,6 +2,14 @@ view all the comments for a particular patch, or to add a comment or make other changes, click on the patch name.

+[% IF status_count_list.size > 0 %] +

Status Summary. +[% FOREACH sc = status_count_list %] +[% sc.patch_status %]: [% sc.num_patches %][% IF !loop.last %],[% ELSE %].[% END %] +[% END %] Total: [% total_count %]. +

+[% END %] + [% FOREACH g = patch_grouping %]

[% g.name | htmlsafe %]

-- 2.39.5