summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Stationboard.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-12-26 10:56:58 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-12-26 10:56:58 +0100
commitcf28090a1cba71687b5166d6bc6cf4939e3e32a0 (patch)
treede52f0ff11b21d859b24e5a6704e217454998214 /lib/DBInfoscreen/Controller/Stationboard.pm
parentf52eb1cec0b5eb8d2ef901a73267394263b55fc6 (diff)
fix wagon order for wing trains2.4.1
Diffstat (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index c3c720b..9ebaca4 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -102,11 +102,26 @@ sub log_api_access {
return;
}
-sub check_wagonorder {
+sub check_wagonorder_with_wings {
my ( $ua, $cache, $train, $wr_link ) = @_;
+ if ( check_wagonorder( $ua, $cache, $train->train_no, $wr_link ) ) {
+ return 1;
+ }
+ elsif ( $train->is_wing ) {
+ my $wing = $train->wing_of;
+ if ( check_wagonorder( $ua, $cache, $wing->train_no, $wr_link ) ) {
+ return 1;
+ }
+ }
+ return;
+}
+
+sub check_wagonorder {
+ my ( $ua, $cache, $train_no, $wr_link ) = @_;
+
my $url
- = "https://lib.finalrewind.org/dbdb/has_wagonorder/${train}/${wr_link}";
+ = "https://lib.finalrewind.org/dbdb/has_wagonorder/${train_no}/${wr_link}";
if ( my $content = $cache->get($url) ) {
return $content eq 'y' ? 1 : undef;
@@ -972,9 +987,9 @@ sub handle_request {
if (
$departures[-1]{wr_link}
- and not check_wagonorder(
- $self->ua, $self->app->cache_iris_main,
- $result->train_no, $departures[-1]{wr_link}
+ and not check_wagonorder_with_wings(
+ $self->ua, $self->app->cache_iris_main,
+ $result, $departures[-1]{wr_link}
)
)
{