summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-08-14 06:30:56 +0200
committerDaniel Friesel <derf@finalrewind.org>2012-08-14 06:30:56 +0200
commit6f008b7f56ee44f0149ca59cf3d3fec90cc28f76 (patch)
tree14057767e0081fa82e3fb2be5a610c03a5a89938
parentf39a87e86d10277bbb39785a3c5cf1af566d9e64 (diff)
only display first departure per platform in single mode
-rw-r--r--cgi/index.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/cgi/index.pl b/cgi/index.pl
index 1e33e48..10f6880 100644
--- a/cgi/index.pl
+++ b/cgi/index.pl
@@ -54,6 +54,20 @@ sub handle_request {
return;
}
+ if ($template eq 'single') {
+ if (not @platforms) {
+ for my $result (@results) {
+ if (not ($result->platform ~~ \@platforms)) {
+ push(@platforms, $result->platform);
+ }
+ }
+ @platforms = sort { $a <=> $b } @platforms;
+ }
+ my %pcnt;
+ @results = grep { $pcnt{$_->platform}++ < 1 } @results;
+ @results = sort { $a->platform <=> $b->platform } @results;
+ }
+
for my $result (@results) {
my $platform = ( split( / /, $result->platform ) )[0];
if ($via) {