diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-09-08 17:48:09 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-09-08 17:48:09 +0200 |
commit | 44cdac57eed0f02c8801ed85d08be4e7daead991 (patch) | |
tree | aceca03a6158fa415302ca138865dfbfd9042c5f /lib/DBInfoscreen/Helper | |
parent | eddc7b007631290b4569676d4b3e1019894858bb (diff) |
move tripid generation to trainsearch helper
Diffstat (limited to 'lib/DBInfoscreen/Helper')
-rw-r--r-- | lib/DBInfoscreen/Helper/HAFAS.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm index 2eda72f..2eb156c 100644 --- a/lib/DBInfoscreen/Helper/HAFAS.pm +++ b/lib/DBInfoscreen/Helper/HAFAS.pm @@ -198,6 +198,18 @@ sub trainsearch { } } + if ($result) { + + # The trip_id's date part doesn't seem to matter -- so far, HAFAS is + # happy as long as the date part starts with a number. HAFAS-internal + # tripIDs use this format (withouth leading zero for day of month < 10) + # though, so let's stick with it. + my $date_map = $opt{date_yyyy}; + $date_map =~ tr{.}{}d; + $result->{trip_id} = sprintf( '1|%d|%d|%d|%s', + $result->{id}, $result->{cycle}, $result->{pool}, $date_map ); + } + return $result; } |