summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.pl11
1 files changed, 10 insertions, 1 deletions
diff --git a/index.pl b/index.pl
index a6c48c7..b12a274 100644
--- a/index.pl
+++ b/index.pl
@@ -444,6 +444,7 @@ get '/top10' => sub {
my $where_clause = '1=1';
my ( $filter, $filter_clause ) = $self->parse_filter_args;
+ my %translation = Travel::Status::DE::IRIS::Result::dump_message_codes();
my @rates;
my $dbh = $self->app->dbh;
@@ -462,9 +463,17 @@ get '/top10' => sub {
};
$rates[$msgnum] = $self->app->dbh->selectall_arrayref($query)->[0][0];
- say $rates[$msgnum] / $total;
+ say "$msgnum: " . $rates[$msgnum] / $total;
}
+ my @argsort = reverse sort { $rates[$a] <=> $rates[$b] } ( 1 .. 99 );
+
+ for my $i (@argsort[0 .. 10]) {
+ printf("%s: %.2f%%\n", $translation{$i}, $rates[$i] * 100 / $total);
+ }
+
+ say join(' ', @argsort[0 .. 10]);
+
$self->render( 'intro', );
return;
};