diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-03-06 19:48:47 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-03-06 19:48:47 +0100 |
commit | 7614dc8ff0318e14e1cd7a590ee817ce5050923e (patch) | |
tree | ddd51c1a74ed8610610e061cbe5ad62ea6a42ab0 /index.pl | |
parent | 4080ac1b6ab3bcd33ac1e370b217f433cebad1f1 (diff) |
barform: add optional filters (TODO: Lol Encoding)
Diffstat (limited to 'index.pl')
-rw-r--r-- | index.pl | 42 |
1 files changed, 41 insertions, 1 deletions
@@ -91,6 +91,46 @@ helper barplot_args => sub { }; }; +helper barplot_filters => sub { + my ($self) = @_; + my $dbh = $self->app->dbh; + + my $ret = { + lines => [ + map { $_->[0] } @{ + $dbh->selectall_arrayref( +"select distinct train_type || ' ' || line_no as line from $table order by line" + ) + } + ], + train_types => [ + q{}, + map { $_->[0] } @{ + $dbh->selectall_arrayref( + "select distinct train_type from $table order by train_type" + ) + } + ], + stations => [ + q{}, + map { $_->[0] } @{ + $dbh->selectall_arrayref( + "select distinct station from $table order by station") + } + ], + destinations => [ + q{}, + map { $_->[0] } @{ + $dbh->selectall_arrayref( +"select distinct destination from $table order by destination" + ) + } + ], + }; + + return $ret; +}; + helper count_unique_column => sub { my ( $self, $column ) = @_; my $dbh = $self->app->dbh; @@ -294,7 +334,7 @@ get '/2ddata.tsv' => sub { get '/' => sub { my $self = shift; - $self->render('intro', version => $VERSION); + $self->render( 'intro', version => $VERSION ); return; }; |