[Bps-public-commit] App-Changeloggr branch, master, updated. 49fa6d6bb5fe1677117fb432974b5217889d59b5

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 30 15:06:40 EDT 2009


The branch, master has been updated
       via  49fa6d6bb5fe1677117fb432974b5217889d59b5 (commit)
      from  aa477cd4e880c382b07338ae1ac4536d610ae7dd (commit)

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

- Log -----------------------------------------------------------------
commit 49fa6d6bb5fe1677117fb432974b5217889d59b5
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Jul 30 15:06:35 2009 -0400

    Changelog->votes

diff --git a/lib/App/Changeloggr/Model/Changelog.pm b/lib/App/Changeloggr/Model/Changelog.pm
index 47932d6..c73c7fa 100644
--- a/lib/App/Changeloggr/Model/Changelog.pm
+++ b/lib/App/Changeloggr/Model/Changelog.pm
@@ -160,6 +160,34 @@ sub unvoted_changes {
     return $changes;
 }
 
+sub votes {
+    my $self = shift;
+    my $votes = M('VoteCollection');
+
+    my $changes = $votes->join(
+        type        => 'left',
+        column1     => 'change_id',
+        table2      => 'changes',
+        column2     => 'id',
+        is_distinct => 1,
+    );
+
+    $votes->limit(
+        leftjoin => $changes,
+        column   => 'changelog_id',
+        value    => $self->id,
+    );
+
+    $votes->limit(
+        column   => 'id',
+        alias    => $changes,
+        operator => 'IS NOT',
+        value    => 'NULL',
+    );
+
+    return $votes;
+}
+
 sub get_starting_position {
     my $self = shift;
 

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



More information about the Bps-public-commit mailing list