Permalink
Browse files

Sort modules by workingness

  • Loading branch information...
1 parent 4da24c0 commit 2411e04b7fd658af71560ea9ecf23263d4ad1d64 @tadzik committed May 23, 2012
Showing with 19 additions and 3 deletions.
  1. +17 −1 formatter
  2. +2 −2 template.tt
View
@@ -9,4 +9,20 @@ my $json = do { local $/; <$fh> };
close $fh;
my $results = Mojo::JSON->new->decode($json);
-$mt->render_file_to_file('template.tt', 'index.html', $results);
+
+sub sortsub {
+ ($a, $b);
+
+ if ($results->{$a}{'test'} == $results->{$b}{'test'}) {
+ return lc $a cmp lc $b;
+ }
+
+ if ($results->{$a}{'test'} == 0) {
+ return 1
+ }
+
+ return -1
+}
+
+my @list = sort { sortsub @_ } grep { !/^_/ } keys %$results;
+$mt->render_file_to_file('template.tt', 'index.html', $results, \@list);
View
@@ -75,10 +75,10 @@
</thead>
<tbody>
-% my $results = shift;
+% my ($results, $list) = @_;
% my ($ok, $fail, $total);
% my $stats = delete $results->{_statistics};
-% for my $module (sort { lc $a cmp lc $b } keys $results) {
+% for my $module (@$list) {
<tr><td style="border-bottom:1px dotted #98CAEB">
<a href="#"><%= $module %></a>
</td>

0 comments on commit 2411e04

Please sign in to comment.