Stable links for open, in-progress, and previous CommitFests.
authorRobert Haas <[email protected]>
Sat, 4 Jul 2009 00:05:17 +0000 (20:05 -0400)
committerRobert Haas <[email protected]>
Sat, 4 Jul 2009 00:05:17 +0000 (20:05 -0400)
perl-lib/PgCommitFest/CommitFest.pm
perl-lib/PgCommitFest/DB.pm
template/commitfest_search.tt2

index de190056ca2c70c9846dae5d164765ab47fd5011..a4115b2ef5398d93342bcabc0c2a388ba003260f 100644 (file)
@@ -86,11 +86,39 @@ EOM
 }
 
 sub view {
-       my ($r) = @_;
+       my ($r, $extrapath) = @_;
        my $aa = $r->authenticate();
+
+       # Target commitfest can be specified either by ID, or we allow special
+       # magic to fetch it by 
        my $id = $r->cgi_id();
-       my $d = $r->db->select_one(<<EOM, $id) if defined $id;
-SELECT id, name, commitfest_status FROM commitfest_view WHERE id = ?
+       my $sqlbit;
+       if (defined $id) {
+               $sqlbit = "WHERE id = " . $r->db->quote($id);
+       }
+       elsif (defined $extrapath) {
+               if ($extrapath eq 'open') {
+                       $sqlbit =
+                               "WHERE commitfest_status_id = 2 ORDER BY name DESC LIMIT 1";
+               }
+               elsif ($extrapath eq 'inprogress') {
+                       $sqlbit = <<EOM;
+WHERE commitfest_status_id IN (2, 3)
+       ORDER BY commitfest_status_id DESC, name DESC LIMIT 1
+EOM
+               }
+               elsif ($extrapath eq 'previous') {
+                       $sqlbit =
+                               "WHERE commitfest_status_id = 4 ORDER BY name DESC LIMIT 1";
+               }
+       }
+       if (!defined $sqlbit) {
+               $r->error_exit("Unable to identify target CommitFest.");
+       }
+
+       # Fetch target commitfest from database.
+       my $d = $r->db->select_one(<<EOM);
+SELECT id, name, commitfest_status FROM commitfest_view $sqlbit
 EOM
        $r->error_exit('CommitFest not found.') if !defined $d;
        $r->set_title('CommitFest %s (%s)', $d->{'name'},
index 0cd3b7d483f5802e288921bcea105ec1136dc9fa..471900784ecb28e43db4907f1963dfb88296ced2 100644 (file)
@@ -89,6 +89,11 @@ sub insert_returning_id {
        return $result->{'id'};
 }
 
+sub quote {
+       my ($self, $value) = @_;
+       return $self->{'dbh'}->quote($value);
+}
+
 sub rollback {
        my ($self) = @_;
        $self->{'dirty'} = 0;
index ab34187772d4e80fe06c4b0aac113b5f27852512..9a14dd633cec00d1cea706e5a7aae34757a65912 100644 (file)
@@ -1,9 +1,16 @@
-<p>If you want to submit a new patch for review, please visit the <b>Open</b>
-CommitFest.  If you want to help with the reviewing process for the
+<p>If you have submitted a patch to pgsql-hackers and want it to be reviewed,
+you should add it to the <a href='/action/commitfest_view/open'>Open
+CommitFest</a>.  If you want to help with the reviewing process for the
 CommitFest that's currently taking place (if any), please visit the
-CommitFest <b>In Progress</b>.  Previous CommitFests are marked as
-<b>Closed</b>, and scheduled upcoming CommitFests (other than the one to which
-patches should be submitted) are marked as <b>Future</b>.</p>
+<a href='/action/commitfest_view/inprogress'>CommitFest In Progress</a>.
+These links are stable and always reference the open or in progress
+CommitFest, respectively, provided such a CommitFest exists.  (If there is no
+CommitFest in progress, the CommitFest In Progress link will reference the
+Open CommitFest instead.)  There is also a stable link for the
+<a href='/action/commitfest_view/previous'>Previous CommitFest</a>, meaning
+the most recent one that is now marked Closed.  Upcoming CommitFests
+(other than the one to which patches should be submitted) are marked
+as <b>Future</b>.</p>
 
 [% IF list.size == 0 %]
 <p><b>No CommitFests have been defined yet.</b></p>