Skip to content

Commit

Permalink
Sort modules by workingness
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed May 23, 2012
1 parent 4da24c0 commit 2411e04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion formatter
Expand Up @@ -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);
4 changes: 2 additions & 2 deletions template.tt
Expand Up @@ -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>
Expand Down

0 comments on commit 2411e04

Please sign in to comment.