Commit 0fbac796 authored by Volker Krause's avatar Volker Krause
Browse files

Determine ticket names for RCT2 tickets

parent c05035f0
......@@ -10,6 +10,7 @@
"outboundDepartureTime": "2018-08-19T07:40:00",
"passengerName": "Jőhn Á Doe",
"seatNumber": "101, 102",
"title": "MENETJEGY+HELYJEGY",
"trainNumber": "RJX 42",
"type": "http://schema.org/TransportReservation"
}
......
[
{
"@context": "http://schema.org",
"@type": "Rct2Ticket",
"coachNumber": "280",
"firstDayOfValidity": "2018-01-01",
"outboundArrivalStation": "NUERNBERG",
"outboundArrivalTime": "2018-12-29T02:37:00",
"outboundClass": "2",
"outboundDepartureStation": "SOMEWHERE HBF",
"outboundDepartureTime": "2018-12-29T01:37:00",
"passengerName": "Lastname Firs",
"seatNumber": "FENSTER 046",
"trainNumber": "NJ 421",
"type": "http://schema.org/TransportReservation"
}
"@context": "http://schema.org",
"@type": "Rct2Ticket",
"coachNumber": "280",
"firstDayOfValidity": "2018-01-01",
"outboundArrivalStation": "NUERNBERG",
"outboundArrivalTime": "2018-12-29T02:37:00",
"outboundClass": "2",
"outboundDepartureStation": "SOMEWHERE HBF",
"outboundDepartureTime": "2018-12-29T01:37:00",
"passengerName": "Lastname Firs",
"seatNumber": "FENSTER 046",
"title": "FAHRSCHEIN + RESERVIERUNG",
"trainNumber": "NJ 421",
"type": "http://schema.org/TransportReservation"
}
]
......@@ -7,6 +7,7 @@
"outboundClass": "2",
"outboundDepartureStation": "Duisburg",
"passengerName": "Last Name Firstn",
"title": "ICE Fahrkarte",
"type": "http://schema.org/Transport"
}
]
......@@ -9,6 +9,7 @@
"outboundDepartureStation": "WIEN HBF",
"outboundDepartureTime": "2017-09-16T18:58:00",
"passengerName": "Lastname Name",
"title": "FAHRSCHEIN",
"type": "http://schema.org/Transport"
}
]
......@@ -7,6 +7,7 @@
"outboundClass": "1",
"outboundDepartureStation": "GRAZ",
"passengerName": "Lastname Name",
"title": "FAHRSCHEIN",
"type": "http://schema.org/Transport"
}
]
......@@ -9,6 +9,7 @@
"outboundDepartureStation": "VISP",
"outboundDepartureTime": "2012-09-21T00:00:00",
"passengerName": "Last Name First Nam",
"title": "Normales Billett Schweiz",
"type": "http://schema.org/Transport"
}
]
......@@ -9,6 +9,7 @@
"outboundDepartureStation": "København",
"outboundDepartureTime": "2018-12-08T17:22:00",
"seatNumber": "103",
"title": "RESERVATION",
"trainNumber": "267",
"type": "http://schema.org/Reservation"
}
......
......@@ -10,6 +10,7 @@
"outboundDepartureStation": "VERONA PN",
"outboundDepartureTime": "2010-05-16T11:02:00",
"seatNumber": "FENSTER 023",
"title": "RESERVIERUNG",
"trainNumber": "EC 42",
"type": "http://schema.org/Reservation"
}
......
[
{
"@context": "http://schema.org",
"@type": "Rct2Ticket",
"passengerName": "Künqi Dr Dragn",
"title": "VVT: Einzel-Ticket",
"type": "http://schema.org/Unknown"
}
]
U_TLAY010262RCT200051201011400014Zonenanzahl: 90001044100087VVT: Einzel-Ticket
So, 26. Feb 2023 um 12:00
zum Fahrtantritt innerhalb von 2 Stunden.1352011900019PREIS EUR 18,100052031500041Künqi Dr Dragn
1x Erwachsene/r
2. Klasse0801021400028664XX Abcd ->
664XX Efghijk
\ No newline at end of file
......@@ -163,6 +163,17 @@ Rct2Ticket::Type Rct2Ticket::type() const
return Unknown;
}
QString Rct2Ticket::title() const
{
// somewhat standard compliant layout
if (d->layout.text(0, 15, 3, 1).trimmed().isEmpty()) {
return d->layout.text(0, 18, 33, 1).trimmed();
}
// "creative" layout
return d->layout.text(0, 0, 52, 1).trimmed();
}
QString Rct2Ticket::passengerName() const
{
return d->layout.text(0, 52, 19, 1).trimmed();
......
......@@ -24,6 +24,7 @@ class KITINERARY_EXPORT Rct2Ticket
Q_GADGET
Q_PROPERTY(QDate firstDayOfValidity READ firstDayOfValidity)
Q_PROPERTY(Type type READ type)
Q_PROPERTY(QString title READ title)
Q_PROPERTY(QString passengerName READ passengerName)
Q_PROPERTY(QDateTime outboundDepartureTime READ outboundDepartureTime)
Q_PROPERTY(QDateTime outboundArrivalTime READ outboundArrivalTime)
......@@ -65,6 +66,9 @@ public:
/** Returns the ticket type. */
Type type() const;
/** Name or title of the ticket. */
QString title() const;
/** Name of the passenger this ticket is for. */
QString passengerName() const;
......
......@@ -137,7 +137,12 @@ QString Uic9183Parser::name() const
}
}
// TODO RCT2 tickets
// RCT2
const auto rct2 = rct2Ticket();
if (rct2.isValid()) {
return rct2.title();
}
return {};
}
......
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