Permalink
Browse files

id isn't queue order if a SmokeResult is re-tested

Add a queued_at timestamp to order the upcoming tests list correctly
  • Loading branch information...
1 parent 6da83d5 commit 53d9373e4d6ed8d6e04bd71a9a2b4b024cb09e5a @alexmv alexmv committed Jul 29, 2011
Showing with 14 additions and 10 deletions.
  1. +1 −1 etc/config.yml
  2. +5 −6 lib/Smokingit/Model/Project.pm
  3. +5 −0 lib/Smokingit/Model/SmokeResult.pm
  4. +3 −3 lib/Smokingit/View/Project.pm
View
@@ -11,7 +11,7 @@ framework:
Host: localhost
Password: ''
User: postgres
- Version: 0.0.4
+ Version: 0.0.5
DevelMode: 1
LogLevel: INFO
Mailer: Sendmail
@@ -110,13 +110,12 @@ sub planned_tests {
value => "NULL"
);
$tests->limit( column => "project_id", value => $self->id );
+ $tests->order_by(
+ { column => "queued_at", order => "asc" },
+ { column => "id", order => "asc" },
+ );
$tests->prefetch( name => "commit" );
- my @tests = @{ $tests->items_array_ref };
- @tests = sort { $a->gearman_status->known <=> $b->gearman_status->known
- or $b->gearman_status->running <=> $a->gearman_status->running
- or ($b->gearman_status->percent||0) <=> ($a->gearman_status->percent||0)
- or $a->id <=> $b->id} @tests;
- return @tests;
+ return $tests;
}
sub update_repository {
@@ -31,6 +31,10 @@ use Smokingit::Record schema {
column gearman_process =>
type is 'text';
+ column queued_at =>
+ is timestamp,
+ since '0.0.5';
+
column submitted_at =>
is timestamp;
@@ -111,6 +115,7 @@ sub run_smoke {
return 0;
}
$self->set_gearman_process($job_id);
+ $self->set_queued_at( Jifty::DateTime->now );
return 1;
}
@@ -70,13 +70,13 @@ template '/project' => page {
};
}
- my @planned = get('project')->planned_tests;
- if (@planned) {
+ my $planned = get('project')->planned_tests;
+ if ($planned->count) {
div {
id is "planned-tests";
class is "commitlist";
h2 { "Planned tests" };
- test_result($_) for @planned;
+ test_result($_) while $_ = $planned->next;
}
}
};

0 comments on commit 53d9373

Please sign in to comment.