[Bps-public-commit] App-Changeloggr branch, master, updated. eb12360a5c612191b7a61ed46d9abb9ebfe19829
sartak at bestpractical.com
sartak at bestpractical.com
Tue Jun 9 10:56:39 EDT 2009
The branch, master has been updated
via eb12360a5c612191b7a61ed46d9abb9ebfe19829 (commit)
from a3e7bf4c4b22bbff00697e6df1dad98567dafd7f (commit)
Summary of changes:
lib/App/Changeloggr/Model/User.pm | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit eb12360a5c612191b7a61ed46d9abb9ebfe19829
Author: Shawn M Moore <sartak at gmail.com>
Date: Tue Jun 9 10:49:28 2009 -0400
User->undo_vote
diff --git a/lib/App/Changeloggr/Model/User.pm b/lib/App/Changeloggr/Model/User.pm
index 3efca0c..17b12c5 100644
--- a/lib/App/Changeloggr/Model/User.pm
+++ b/lib/App/Changeloggr/Model/User.pm
@@ -83,5 +83,26 @@ EOSQL
return ($votes, $place);
}
+sub undo_vote {
+ my $self = shift;
+ my $votes = $self->votes;
+ $votes->order_by(
+ column => 'id',
+ order => 'DESC',
+ );
+ $votes->set_page_info(
+ current_page => 1,
+ per_page => 1,
+ );
+
+ my $vote = $votes->first;
+
+ if (!$vote) {
+ return (0, "No vote to delete");
+ }
+
+ return $vote->delete;
+}
+
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list