[Bps-public-commit] App-Changeloggr branch, master, updated. 5fe61f3575d30e02e49876acfa6d88fa5f883937

sartak at bestpractical.com sartak at bestpractical.com
Tue Aug 18 01:30:37 EDT 2009


The branch, master has been updated
       via  5fe61f3575d30e02e49876acfa6d88fa5f883937 (commit)
       via  36a2b800ba6d11386cab9af1af30a7e6aef981ee (commit)
      from  30f52f601c8e5e9edae4e547b05eabadd78564ef (commit)

Summary of changes:
 lib/App/Changeloggr/Model/Changelog.pm |   18 +++++++++++-------
 lib/App/Changeloggr/View.pm            |   11 ++++++++++-
 2 files changed, 21 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 36a2b800ba6d11386cab9af1af30a7e6aef981ee
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Aug 18 01:30:03 2009 -0400

    Support skipping more than one change in choose_next_change

diff --git a/lib/App/Changeloggr/Model/Changelog.pm b/lib/App/Changeloggr/Model/Changelog.pm
index 30a4c8c..47ab93f 100644
--- a/lib/App/Changeloggr/Model/Changelog.pm
+++ b/lib/App/Changeloggr/Model/Changelog.pm
@@ -231,19 +231,23 @@ sub choose_change {
 }
 
 sub choose_next_change {
-    my $self = shift;
+    my $self  = shift;
+    my $count = shift || 1;
 
     Jifty->handle->begin_transaction;
 
-    my $change = $self->choose_change(1)
-        or return;
+    for (0 .. $count) {
+        my $change = $self->choose_change(1)
+            or return;
 
-    my $tag = $self->tags->first
-        or return;
+        my $tag = $self->tags->first
+            or return;
 
-    $change->vote($tag->text);
+        $change->vote($tag->text);
+    }
 
-    my $next_change = $self->choose_change(1);
+    my $next_change = $self->choose_change(1)
+        or return;
 
     Jifty->handle->force_rollback;
 

commit 5fe61f3575d30e02e49876acfa6d88fa5f883937
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Aug 18 01:30:23 2009 -0400

    If we're preloading, skip an additional change

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 1d519b4..4957f2e 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -113,10 +113,12 @@ template '/vote-on-change' => sub {
     if (get('change')) {
         $change = M('Change', id => get('change'));
         $changelog = $change->changelog;
+        set(skipped_change => 1);
     }
     else {
         $changelog = M('Changelog', id => get('changelog'));
         $change = $changelog->choose_change;
+        set(skipped_change => 0);
     }
 
     if ($change) {
@@ -315,7 +317,14 @@ sub show_vote_form {
     my $change = shift;
     my $changelog = $change->changelog;
     my $valid_tags = $change->prioritized_tags;
-    my $next_change = $changelog->choose_next_change;
+    my $next_change;
+
+    if (get('skipped_change')) {
+        $next_change = $changelog->choose_next_change(2);
+    }
+    else {
+        $next_change = $changelog->choose_next_change;
+    }
 
     div {
         id is 'vote_buttons';

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list