Commit e7f5c742 authored by Volker Krause's avatar Volker Krause
Browse files

Work around ERA SSB departure times being somewhat unreliable for Thalys

Not sure whether it's wrong in the ticket or whether our interpretation
is wrong, but for some we end up with an off by one departure day.
parent da46c714
Pipeline #242010 failed with stage
in 4 minutes and 53 seconds
......@@ -60,6 +60,10 @@ function parsePdfTicket(pdf, node, triggerNode)
const page = pdf.pages[triggerNode.location];
var res = triggerNode.result[0];
// determine departure day - this is in the ERA SSB code, but seems to occasionally be off by one day?
const depDay = page.text.match(/\d\d\/\d{2}\/\d{4} +(\d{2})\/(\d{2})\/(\d{4})/);
res.reservationFor.departureDay = depDay[3] + '-' + depDay[2] + '-' + depDay[1] + 'T00:00:00';
const dep = page.textInRect(0.0, 0.15, 0.35, 0.3).match(/([\s\S]+)\n(?:DÉPART À|ABFAHRT)\n(\d\d:\d\d)/);
res.reservationFor.departureStation.name = dep[1];
res.reservationFor.departureTime = res.reservationFor.departureDay.substr(0, 11) + dep[2];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment