Commit 60351fa0 authored by Volker Krause's avatar Volker Krause
Browse files

Trigger the Norwegian boarding pass extractor also on its barcode content

This works also without the surrounding email. Also make it more robust
towards different date variants found in the wild.
parent 37c9f28d
Pipeline #55515 passed with stages
in 12 minutes and 54 seconds
......@@ -26,12 +26,16 @@ function parsePage(page)
res.reservationFor.departureAirport.iataCode = dep[3];
res.reservationFor.departureTerminal = dep[4];
res.reservationFor.departureTime = JsonLd.toDateTime(flight[3] + dep[1], "dd MMM yyyyhh:mm", "en");
if (isNaN(res.reservationFor.departureTime.getTime()))
res.reservationFor.departureTime = JsonLd.toDateTime(flight[3] + dep[1], "yyyy MMM ddhh:mm", "en");
var arr = page.text.match(/\Arrival.*(\d{2}:\d{2}) (.*) \(([A-Z]{3})\)(.*)\n/);
res.reservationFor.arrivalAirport.name = arr[2];
res.reservationFor.arrivalAirport.iataCode = arr[3];
res.reservationFor.arrivalTerminal = arr[4];
res.reservationFor.arrivalTime = JsonLd.toDateTime(flight[3] + arr[1], "dd MMM yyyyhh:mm", "en");
if (isNaN(res.reservationFor.arrivalTime.getTime()))
res.reservationFor.arrivalTime= JsonLd.toDateTime(flight[3] + arr[1], "yyyy MMM ddhh:mm", "en");
var seat = page.text.match(/Seat.* (\d{1,3}[A-J]) .*\n/);
if (seat) {
......
......@@ -5,6 +5,12 @@
"match": "noreply@norwegian",
"mimeType": "message/rfc822",
"scope": "Ancestors"
},
{
"field": "reservationFor.airline.iataCode",
"match": "D[8Y]",
"mimeType": "application/ld+json",
"scope": "Descendants"
}
],
"function": "extractPdf",
......
Markdown is supported
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