[Bps-public-commit] smokingit branch, master, updated. aff8ab46b941659a092954fdf4dc5d9ac02ac481

Alex Vandiver alexmv at bestpractical.com
Wed Aug 3 16:59:59 EDT 2011


The branch, master has been updated
       via  aff8ab46b941659a092954fdf4dc5d9ac02ac481 (commit)
       via  ad2c7e9703c1de87a222da4162995954bfb7f419 (commit)
      from  bf412494e3c358d0a2888c790eb42423727f49ee (commit)

Summary of changes:
 lib/Smokingit/Model/Project.pm |   16 ++++++++++++++++
 lib/Smokingit/Upgrade.pm       |    3 ++-
 lib/Smokingit/View/Project.pm  |   11 +----------
 3 files changed, 19 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit ad2c7e9703c1de87a222da4162995954bfb7f419
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sun Jul 31 18:36:42 2011 -0400

    Refactor list of finished tests into model

diff --git a/lib/Smokingit/Model/Project.pm b/lib/Smokingit/Model/Project.pm
index e34da0e..20b5677 100644
--- a/lib/Smokingit/Model/Project.pm
+++ b/lib/Smokingit/Model/Project.pm
@@ -118,6 +118,22 @@ sub planned_tests {
     return $tests;
 }
 
+sub finished_tests {
+    my $tests = Smokingit::Model::SmokeResultCollection->new;
+    $tests->limit(
+        column => "gearman_process",
+        operator => "IS",
+        value => "NULL"
+    );
+    $tests->limit( column => "project_id", value => $self->id );
+    $tests->order_by(
+        { column => "submitted_at", order  => "desc" },
+        { column => "id",           order  => "desc" },
+    );
+    $tests->prefetch( name => "commit" );
+    return $tests;
+}
+
 sub update_repository {
     my $self = shift;
     local $ENV{GIT_DIR} = $self->repository_path;
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index 9f566c8..8f1cfed 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -50,16 +50,7 @@ template '/project' => page {
             };
         };
 
-        my $tests = Smokingit::Model::SmokeResultCollection->new;
-        $tests->limit(
-            column => "gearman_process",
-            operator => "IS",
-            value => "NULL"
-        );
-        $tests->limit( column => "project_id", value => get('project')->id );
-        $tests->prefetch( name => "commit" );
-        $tests->order_by( { column => "submitted_at", order  => "desc" },
-                          { column => "id",           order  => "desc" } );
+        my $tests = get('project')->finished_tests;
         $tests->rows_per_page(10);
         if ($tests->count) {
             div {

commit aff8ab46b941659a092954fdf4dc5d9ac02ac481
Author: Alex Vandiver <alex at chmrr.net>
Date:   Wed Aug 3 16:58:32 2011 -0400

    $test->from_branch no longer exists as a method call when this is run

diff --git a/lib/Smokingit/Upgrade.pm b/lib/Smokingit/Upgrade.pm
index 71476d9..d923537 100644
--- a/lib/Smokingit/Upgrade.pm
+++ b/lib/Smokingit/Upgrade.pm
@@ -25,11 +25,12 @@ since '0.0.3' => sub {
 since '0.0.4' => sub {
     my $tests = Smokingit::Model::SmokeResultCollection->new( current_user => $super );
     $tests->unlimit;
+    $tests->columns( "id" );
     $tests->prefetch( name => "from_branch" );
     my %branches;
     while (my $test = $tests->next) {
         my $branch = $test->prefetched( "from_branch" );
-        $test->set_branch_name($test->from_branch->name);
+        $test->set_branch_name($branch->name);
     }
 };
 

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



More information about the Bps-public-commit mailing list