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

Support English TGV inoui tickets

Addresses the incomplete data in the screenshots of issue #29.
parent 4290b9ea
......@@ -64,26 +64,26 @@ function parseInouiPdfText(page)
return reservations;
var pos = date.index + date[0].length;
while (true) {
var dep = text.substr(pos).match(/(\d+h\d+) +(.*)\n/);
var dep = text.substr(pos).match(/(\d+[h:]\d+) +(.*)\n/);
if (!dep)
break;
pos += dep.index + dep[0].length;
var res = JsonLd.newTrainReservation();
res.reservationFor.departureTime = JsonLd.toDateTime(date[1] + dep[1], "d MMMM yyyyhh'h'mm", "fr");
res.reservationFor.departureTime = JsonLd.toDateTime(date[1] + dep[1], ["d MMMM yyyyhh'h'mm", "dd MMMM yyyyhh:mm"], ["fr", "en"]);
res.reservationFor.departureStation.name = dep[2];
var arr = text.substr(pos).match(/(\d+h\d+) +(.*)\n/);
var arr = text.substr(pos).match(/(\d+[h:]\d+) +(.*)\n/);
if (!arr)
break;
var endPos = arr.index + arr[0].length;
res.reservationFor.arrivalTime = JsonLd.toDateTime(date[1] + arr[1], "d MMMM yyyyhh'h'mm", "fr");
res.reservationFor.arrivalTime = JsonLd.toDateTime(date[1] + arr[1], ["d MMMM yyyyhh'h'mm", "dd MMMM yyyyhh:mm"], ["fr", "en"]);
res.reservationFor.arrivalStation.name = arr[2];
var detailsText = text.substr(pos, endPos - arr[0].length);
var train = detailsText.match(/^ *(.*?) *-/);
res.reservationFor.trainNumber = train[1];
var seat = detailsText.match(/Voiture *(\d+) *Place *(\d+)/);
var seat = detailsText.match(/(?:Voiture|Coach) *(\d+) *(?:Place|Seat) *(\d+)/);
if (seat) {
res.reservedTicket.ticketedSeat.seatSection = seat[1];
res.reservedTicket.ticketedSeat.seatNumber = seat[2];
......
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