summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-02-24 16:52:58 +0100
committerDaniel Friesel <derf@finalrewind.org>2015-02-24 16:52:58 +0100
commitd875cb43254b4c3de0081b3c54d4cae3708d3ca4 (patch)
tree3266d519831da774443c7da76caf63cf6e7327f0
parent9205499fee8c80df7f6903d6e7772a68e401173b (diff)
tsv: add realtime_rate metric
-rw-r--r--index.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/index.pl b/index.pl
index 3eb83e3..24519bf 100644
--- a/index.pl
+++ b/index.pl
@@ -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} ) {