Commit 9a091a7c authored by Volker Krause's avatar Volker Krause
Browse files

Fix merging of unbound train reservations

parent 9219e947
[
{
"@context": "http://schema.org",
"@type": "TrainReservation",
"modifiedTime": "2020-01-01T00:00:00",
"reservationFor": {
"@type": "TrainTrip",
"arrivalStation": {
"@type": "TrainStation",
"name": "ZONE BRUSSEL"
},
"departureDay": "2020-02-28",
"departureStation": {
"@type": "TrainStation",
"name": "AMSTERDAM CENTRAAL"
}
},
"reservationNumber": "XXX007",
"reservedTicket": {
"@type": "Ticket",
"ticketToken": "aztecbin:ABCDEFGH",
"ticketedSeat": {
"@type": "Seat",
"seatingType": "2"
}
},
"underName": {
"@type": "Person",
"name": "Dr Konqui"
}
}
]
[
{
"@context": "http://schema.org",
"@type": "TrainReservation",
"modifiedTime": "2020-01-01T00:00:00",
"reservationFor": {
"@type": "TrainTrip",
"arrivalStation": {
"@type": "TrainStation",
"name": "ZONE BRUSSEL"
},
"departureDay": "2020-02-28",
"departureStation": {
"@type": "TrainStation",
"name": "AMSTERDAM CENTRAAL"
}
},
"reservationNumber": "XXX007",
"reservedTicket": {
"@type": "Ticket",
"ticketToken": "aztecbin:ABCDEFGH",
"ticketedSeat": {
"@type": "Seat",
"seatingType": "2"
}
},
"underName": {
"@type": "Person",
"name": "Dr Konqui"
}
}
]
[
{
"@context": "http://schema.org",
"@type": "TrainReservation",
"modifiedTime": "2020-01-01T00:00:00",
"reservationFor": {
"@type": "TrainTrip",
"arrivalStation": {
"@type": "TrainStation",
"name": "ZONE BRUSSEL"
},
"departureDay": "2020-02-28",
"departureStation": {
"@type": "TrainStation",
"name": "AMSTERDAM CENTRAAL"
}
},
"reservationNumber": "XXX007",
"reservedTicket": {
"@type": "Ticket",
"ticketToken": "aztecbin:ABCDEFGH"
}
}
]
......@@ -311,6 +311,16 @@ static bool isSameLineName(const QString &lhs, const QString &rhs)
static bool isSameTrainTrip(const TrainTrip &lhs, const TrainTrip &rhs)
{
if (lhs.departureDay() != rhs.departureDay()) {
return false;
}
// for unbound tickets, comparing the line number below wont help
// so we have to use the slightly less robust location comparisson
if (!lhs.departureTime().isValid() && !rhs.departureTime().isValid()) {
return lhs.departureStation().name() == rhs.departureStation().name() && lhs.arrivalStation().name() == rhs.departureStation().name();
}
if (lhs.trainNumber().isEmpty() || rhs.trainNumber().isEmpty()) {
qCDebug(CompareLog) << "missing train number" << lhs.trainNumber() << rhs.trainNumber();
return false;
......
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