summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-01-12 19:27:34 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-01-12 19:27:34 +0100
commit2c5e7e8d20b58e9581f8028e273289e893b673ea (patch)
treeb9ac7276a296bd22b08a3ae53a05236b5af3292b /lib
parent96de9c9aeffb10964f521d8ce4edcf1b2bb73f0f (diff)
update ice type map; use SVG cycle links
Diffstat (limited to 'lib')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm21
-rw-r--r--lib/DBInfoscreen/Helper/Wagonorder.pm2
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 85a94e5..c73fe1a 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -10,7 +10,7 @@ use DateTime;
use DateTime::Format::Strptime;
use Encode qw(decode encode);
use File::Slurp qw(read_file write_file);
-use List::Util qw(max);
+use List::Util qw(max uniq);
use List::MoreUtils qw();
use Mojo::JSON qw(decode_json);
use Mojo::Promise;
@@ -789,6 +789,20 @@ sub render_train {
return;
}
)->wait;
+ $departure->{composition}
+ = $self->app->train_details_db->{ $departure->{train_no} };
+ my @cycle_from;
+ my @cycle_to;
+ for my $cycle ( values %{ $departure->{composition}->{cycle} // {} } ) {
+ push( @cycle_from, @{ $cycle->{from} // [] } );
+ push( @cycle_to, @{ $cycle->{to} // [] } );
+ }
+ @cycle_from = sort { $a <=> $b } uniq @cycle_from;
+ @cycle_to = sort { $a <=> $b } uniq @cycle_to;
+ $departure->{cycle_from}
+ = [ map { [ $_, $self->app->train_details_db->{$_} ] } @cycle_from ];
+ $departure->{cycle_to}
+ = [ map { [ $_, $self->app->train_details_db->{$_} ] } @cycle_to ];
}
# Defer rendering until all requests have completed
@@ -799,9 +813,8 @@ sub render_train {
departure => $departure,
linetype => $linetype,
icetype => $self->app->ice_type_map->{ $departure->{train_no} },
- details =>
- $self->app->train_details_db->{ $departure->{train_no} },
- dt_now => DateTime->now( time_zone => 'Europe/Berlin' ),
+ details => $departure->{composition} // {},
+ dt_now => DateTime->now( time_zone => 'Europe/Berlin' ),
station_name => $station_name,
nav_link =>
$self->url_for( 'station', station => $station_name )
diff --git a/lib/DBInfoscreen/Helper/Wagonorder.pm b/lib/DBInfoscreen/Helper/Wagonorder.pm
index d303d18..1bbcf5f 100644
--- a/lib/DBInfoscreen/Helper/Wagonorder.pm
+++ b/lib/DBInfoscreen/Helper/Wagonorder.pm
@@ -101,7 +101,7 @@ sub has_cycle_p {
my ( $self, $train_no ) = @_;
return $self->head_dbdb_p(
- "https://lib.finalrewind.org/dbdb/db_umlauf/${train_no}.png");
+ "https://lib.finalrewind.org/dbdb/db_umlauf/${train_no}.svg");
}
sub check_wagonorder_p {