summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-03-31 21:57:49 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-03-31 21:57:49 +0200
commitbc642114e5f32158fe9687e4325709882e313cbb (patch)
treec82ba743c3d6a309967c8c312542f8e27dcadc28 /index.pl
parent2c54ad136394f7fef01f5143ee38a2a8e3e46925 (diff)
add date filter
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/index.pl b/index.pl
index 50a0c19..54f2db1 100644
--- a/index.pl
+++ b/index.pl
@@ -229,6 +229,8 @@ helper parse_filter_args => sub {
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'),
);
for my $key ( keys %filter ) {
@@ -255,6 +257,12 @@ helper parse_filter_args => sub {
if ( $filter{destination} ) {
$where_clause .= " and destination = '$filter{destination}'";
}
+ if ( $filter{date_start} ) {
+ $where_clause .= " and scheduled_time >= '$filter{date_start}'";
+ }
+ if ( $filter{date_stop} ) {
+ $where_clause .= " and scheduled_time < '$filter{date_stop}'";
+ }
if ( defined $filter{delay_min} ) {
$where_clause .= " and delay >= $filter{delay_min}";
}
@@ -612,6 +620,14 @@ get '/bar' => sub {
)
);
}
+ if ( $self->param('filter_date_start') ) {
+ push( @title_filter_strings,
+ 'ab ' . $self->param('filter_date_start') );
+ }
+ if ( $self->param('filter_date_stop') ) {
+ push( @title_filter_strings,
+ 'vor ' . $self->param('filter_date_stop') );
+ }
if (@title_filter_strings) {
$title .= ' (' . join( ', ', @title_filter_strings ) . ')';
}