summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-02-25 16:36:07 +0100
committerDaniel Friesel <derf@finalrewind.org>2015-02-25 16:36:07 +0100
commitab02b9ddec2c8fb6bc114ddcd1f37cac6a84a28d (patch)
tree5716907a647d20f659907afc5bc0b64e8446410f
parent87fc996ecf568d6d73a57c3233e28421352057c1 (diff)
more delay metrics
-rw-r--r--index.pl36
1 files changed, 29 insertions, 7 deletions
diff --git a/index.pl b/index.pl
index 1e7888b..5ad92f5 100644
--- a/index.pl
+++ b/index.pl
@@ -52,6 +52,11 @@ helper barplot_args => sub {
},
},
y => {
+ avg_delay => {
+ desc => 'Durchschnittliche Verspätung',
+ label => 'Minuten',
+ yformat => '.1f',
+ },
cancel_num => {
desc => 'Anzahl Zugausfälle',
label => 'Zugausfälle',
@@ -60,10 +65,15 @@ helper barplot_args => sub {
desc => 'Zugausfälle',
yformat => '.1%',
},
- delay => {
- desc => 'Durchschnittliche Verspätung',
- label => 'Minuten',
- yformat => '.1f',
+ delay0_rate => {
+ desc => 'Verspätung = 0 Min.',
+ label => 'Verspätung = 0 Min.',
+ yformat => '.1%',
+ },
+ delay5_rate => {
+ desc => 'Verspätung > 5 Min.',
+ label => 'Verspätung über 5 Min.',
+ yformat => '.1%',
},
realtime_rate => {
desc => 'Echtzeitdaten vorhanden',
@@ -159,7 +169,7 @@ get '/by_hour.json' => sub {
get '/2ddata.tsv' => sub {
my $self = shift;
my $aggregate = $self->param('aggregate') // 'hour';
- my $metric = $self->param('metric') // 'delay';
+ my $metric = $self->param('metric') // 'avg_delay';
my $msgnum = int( $self->param('msgnum') // 0 );
my @weekdays = qw(So Mo Di Mi Do Fr Sa);
@@ -195,6 +205,12 @@ get '/2ddata.tsv' => sub {
}
given ($metric) {
+ when ('avg_delay') {
+ $query = qq{
+ select $format as aggregate,
+ avg(delay) from $table where not is_canceled and $where_clause group by aggregate
+ };
+ }
when ('cancel_num') {
$query = qq{
select $format as aggregate,
@@ -207,10 +223,16 @@ get '/2ddata.tsv' => sub {
avg(is_canceled) from $table where $where_clause group by aggregate
};
}
- when ('delay') {
+ when ('delay0_rate') {
$query = qq{
select $format as aggregate,
- avg(delay) from $table where not is_canceled and $where_clause group by aggregate
+ avg(delay < 1) from $table where $where_clause group by aggregate
+ };
+ }
+ when ('delay5_rate') {
+ $query = qq{
+ select $format as aggregate,
+ avg(delay > 5) from $table where $where_clause group by aggregate
};
}
when ('message_rate') {