[Bps-public-commit] App-Changeloggr branch, master, updated. 838aa65fa06c889337aea2eab52b2d8405fa2e19

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 30 13:16:16 EDT 2009


The branch, master has been updated
       via  838aa65fa06c889337aea2eab52b2d8405fa2e19 (commit)
      from  cf488a3c5e135f53bf26728cf38128aa47c42b3e (commit)

Summary of changes:
 lib/App/Changeloggr/Model/Changelog.pm |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

- Log -----------------------------------------------------------------
commit 838aa65fa06c889337aea2eab52b2d8405fa2e19
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Jul 30 13:15:57 2009 -0400

    Move random-start-place logic from unvoted_changes to choose_change

diff --git a/lib/App/Changeloggr/Model/Changelog.pm b/lib/App/Changeloggr/Model/Changelog.pm
index f266e57..a9b5d08 100644
--- a/lib/App/Changeloggr/Model/Changelog.pm
+++ b/lib/App/Changeloggr/Model/Changelog.pm
@@ -157,20 +157,6 @@ sub unvoted_changes {
         value => 'NULL',
     );
 
-    my $start = $self->current_user->position_for($self);
-    if ($start) {
-        $changes->limit(
-            column   => 'id',
-            operator => '>=',
-            value    => $start,
-        );
-    }
-
-    if ($changes->count == 0 && $start > 0) {
-        $self->current_user->set_position_for($self, 0);
-        return $self->unvoted_changes(@_);
-    }
-
     return $changes;
 }
 
@@ -192,6 +178,21 @@ sub choose_change {
     # the current user has not voted on yet, ordered by the confidence of the
     # top tag. But for now.. an arbitrary change belonging to this changelog.
     my $changes = $self->unvoted_changes;
+
+    my $start = $self->current_user->position_for($self);
+    if ($start) {
+        $changes->limit(
+            column   => 'id',
+            operator => '>=',
+            value    => $start,
+        );
+    }
+
+    if ($changes->count == 0 && $start > 0) {
+        $self->current_user->set_position_for($self, 0);
+        return $self->choose_change(@_);
+    }
+
     $changes->rows_per_page(1);
     $changes->order_by( column => 'date', order => 'asc' );
     return $changes->first;

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



More information about the Bps-public-commit mailing list