diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-09-22 16:40:56 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-09-22 16:40:56 +0200 |
commit | 71284c782b68eadb627dff24a576faa70874300a (patch) | |
tree | a2c1244544b64518a9a8c1901c2ee853afe21979 /cgi | |
parent | 512457a4106650ff79ed709bd744dc91100366ae (diff) |
show as many lines as possible in json format
Diffstat (limited to 'cgi')
-rw-r--r-- | cgi/index.pl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cgi/index.pl b/cgi/index.pl index 022022f..12add75 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -149,8 +149,9 @@ sub get_departures { my (%opt) = @_; my ( @grep_line, @grep_platform ); - my $no_lines = $opt{no_lines} // $default{no_lines}; - my $offset = $opt{offset} // 0; + my $no_lines = $opt{no_lines} // $default{no_lines}; + my $max_lines = $opt{max_lines} // 10; + my $offset = $opt{offset} // 0; my $displayed_lines = 0; my $want_crop = 0; my @fmt_departures; @@ -176,8 +177,8 @@ sub get_departures { @grep_platform = split( qr{,}, $opt{filter_platform} ); } - if ( $no_lines < 1 or $no_lines > 10 ) { - if ( $no_lines >= -10 and $no_lines <= -1 ) { + if ( $no_lines < 1 or $no_lines > $max_lines ) { + if ( $no_lines >= -$max_lines and $no_lines <= -1 ) { $want_crop = 1; $no_lines *= -1; } @@ -299,7 +300,8 @@ sub render_json { my ( $departures, $errstr ) = get_departures( city => $self->stash('city'), stop => $self->stash('stop'), - no_lines => scalar $self->param('no_lines'), + no_lines => scalar $self->param('no_lines') // '-100', + max_lines => 100, backend => scalar $self->param('backend'), filter_line => scalar $self->param('line'), filter_platform => scalar $self->param('platform'), |