Commit 40cfd1ff authored by Volker Krause's avatar Volker Krause
Browse files

Prefer explicit boarding time fields over relevantTime

In some boarding passes relevantTime is actually set to the departure
time instead.
parent 713595bb
Pipeline #233773 passed with stage
in 4 minutes and 18 seconds
......@@ -126,16 +126,6 @@ static bool isPlausibeGate(const QString &s)
static Flight extractBoardingPass(KPkPass::Pass *pass, Flight flight)
{
// "relevantDate" is the best guess for the boarding time
if (pass->relevantDate().isValid() && !flight.boardingTime().isValid()) {
const auto tz = KnowledgeDb::timezoneForAirport(KnowledgeDb::IataCode{flight.departureAirport().iataCode()});
if (tz.isValid()) {
flight.setBoardingTime(pass->relevantDate().toTimeZone(tz));
} else {
flight.setBoardingTime(pass->relevantDate());
}
}
// search for missing information by field key
const auto fields = pass->fields();
for (const auto &field : fields) {
......@@ -158,7 +148,17 @@ static Flight extractBoardingPass(KPkPass::Pass *pass, Flight flight)
}
}
// search for missing information in field content
// "relevantDate" is the best guess for the boarding time if we didn't find an explicit field for it
if (pass->relevantDate().isValid() && !flight.boardingTime().isValid()) {
const auto tz = KnowledgeDb::timezoneForAirport(KnowledgeDb::IataCode{flight.departureAirport().iataCode()});
if (tz.isValid()) {
flight.setBoardingTime(pass->relevantDate().toTimeZone(tz));
} else {
flight.setBoardingTime(pass->relevantDate());
}
}
// search for missing information in field content
const auto depIata = KnowledgeDb::IataCode(flight.departureAirport().iataCode());
const auto arrIata = KnowledgeDb::IataCode(flight.arrivalAirport().iataCode());
const auto frontFields = frontFieldsForPass(pass);
......
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