summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-05-04 16:21:28 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-05-04 16:21:28 +0200
commitafd9cc5fe66b15128b9a5738420f64dda3645c0b (patch)
tree4352ab4c249dae5038948df375ee09eee4a11872
parent4e1d17e14589f5f41910a9e0cc28a9431230f6e4 (diff)
add cancellation filter to toplist
-rw-r--r--index.pl29
-rw-r--r--templates/filterform.html.ep8
2 files changed, 27 insertions, 10 deletions
diff --git a/index.pl b/index.pl
index e45d297..3fe6d66 100644
--- a/index.pl
+++ b/index.pl
@@ -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>