Show status summary on commitfest view page.
authorRobert Haas <robertmhaas@gmail.com>
Wed, 22 Jul 2009 02:12:19 +0000 (22:12 -0400)
committerRobert Haas <robertmhaas@gmail.com>
Wed, 22 Jul 2009 02:12:19 +0000 (22:12 -0400)
perl-lib/PgCommitFest/CommitFest.pm
template/commitfest_view.tt2

index 84cee1f398d97c183f71ba4f4704539738f068e6..695583926293fcb0346a12135147a47a43c666aa 100644 (file)
@@ -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(<<EOM, $d->{'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'},
index 7bb6296c8a017ff5b4965b4bc7a037401a7259cf..5e4db859d040b5ecadb15e84aa75eb3820f990b8 100644 (file)
@@ -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.</p>
 
+[% IF status_count_list.size > 0 %]
+<p><b>Status Summary</b>.
+[% FOREACH sc = status_count_list %]
+[% sc.patch_status %]: [% sc.num_patches %][% IF !loop.last %],[% ELSE %].[% END %]
+[% END %] Total: [% total_count %].
+</p>
+[% END %]
+
 [% FOREACH g = patch_grouping %]
 <h2>[% g.name | htmlsafe %]</h2>