diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-02-24 16:52:58 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-02-24 16:52:58 +0100 |
commit | d875cb43254b4c3de0081b3c54d4cae3708d3ca4 (patch) | |
tree | 3266d519831da774443c7da76caf63cf6e7327f0 | |
parent | 9205499fee8c80df7f6903d6e7772a68e401173b (diff) |
tsv: add realtime_rate metric
-rw-r--r-- | index.pl | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -112,6 +112,13 @@ get '/2ddata.tsv' => sub { (scheduled_time, train_id) where $where_clause group by aggregate }; } + when ('realtime_rate') { + $query = qq{ + select $format as aggregate, + avg(delay is not null) from departures + where $where_clause group by aggregate + }; + } } my $dbres = $self->app->dbh->selectall_arrayref($query); @@ -127,7 +134,7 @@ get '/2ddata.tsv' => sub { . substr( $_->[0], 1 ), $_->[1] ] - } ( @{$dbres}[ 1*24 .. 6*24 ], $dbres->[0] ); + } ( @{$dbres}[ 1 * 24 .. 6 * 24 ], $dbres->[0] ); } for my $row ( @{$dbres} ) { |