diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-05-04 16:21:28 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-05-04 16:21:28 +0200 |
commit | afd9cc5fe66b15128b9a5738420f64dda3645c0b (patch) | |
tree | 4352ab4c249dae5038948df375ee09eee4a11872 | |
parent | 4e1d17e14589f5f41910a9e0cc28a9431230f6e4 (diff) |
add cancellation filter to toplist
-rw-r--r-- | index.pl | 29 | ||||
-rw-r--r-- | templates/filterform.html.ep | 8 |
2 files changed, 27 insertions, 10 deletions
@@ -222,19 +222,20 @@ helper parse_filter_args => sub { my $where_clause = q{}; my %filter = ( - line => scalar $self->param('filter_line'), - train_no => scalar $self->param('filter_train_no'), - train_type => scalar $self->param('filter_train_type'), - station => scalar $self->param('filter_station'), - destination => scalar $self->param('filter_destination'), - delay_min => scalar $self->param('filter_delay_min'), - delay_max => scalar $self->param('filter_delay_max'), - date_start => scalar $self->param('filter_date_start'), - date_stop => scalar $self->param('filter_date_stop'), + line => scalar $self->param('filter_line'), + train_no => scalar $self->param('filter_train_no'), + train_type => scalar $self->param('filter_train_type'), + station => scalar $self->param('filter_station'), + destination => scalar $self->param('filter_destination'), + cancellation => scalar $self->param('filter_cancellation'), + delay_min => scalar $self->param('filter_delay_min'), + delay_max => scalar $self->param('filter_delay_max'), + date_start => scalar $self->param('filter_date_start'), + date_stop => scalar $self->param('filter_date_stop'), ); for my $key ( keys %filter ) { - $filter{$key} =~ tr{.a-zA-Z0-9öäüÖÄÜß }{}cd; + $filter{$key} =~ tr{._a-zA-Z0-9öäüÖÄÜß }{}cd; } $filter{delay_min} @@ -257,6 +258,14 @@ helper parse_filter_args => sub { if ( $filter{destination} ) { $where_clause .= " and destination = '$filter{destination}'"; } + if ( $filter{cancellation} ) { + if ( $filter{cancellation} eq 'only_cancelled' ) { + $where_clause .= ' and is_canceled'; + } + else { + $where_clause .= ' and not is_canceled'; + } + } if ( $filter{date_start} ) { $where_clause .= " and scheduled_time >= '$filter{date_start}'"; } diff --git a/templates/filterform.html.ep b/templates/filterform.html.ep index ed43634..614b36a 100644 --- a/templates/filterform.html.ep +++ b/templates/filterform.html.ep @@ -41,6 +41,14 @@ </div> <div class="field"> <div class="desc"> + Fahrten: + </div> + <div> + %= select_field filter_cancellation => [['Alle' => q{}], ['Ohne Zugausfälle' => 'no_cancelled'], ['Nur Zugausfälle' => 'only_cancelled']] + </div> +</div> +<div class="field"> + <div class="desc"> Verspätung zwischen </div> <div> |