mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T701, do NOT use FsInn data if model string iis unknown
* this can overrride "swift livery strings" * FsInn only is useful with a known model string
This commit is contained in:
committed by
Mat Sutcliffe
parent
c4e9114a83
commit
e389d5ac83
@@ -697,9 +697,10 @@ namespace BlackCore
|
||||
return CAircraftModel();
|
||||
}
|
||||
CAircraftModel model = sApp->getWebDataServices()->getModelForModelString(modelString);
|
||||
const bool isDBModel = model.hasValidDbKey();
|
||||
if (log)
|
||||
{
|
||||
if (model.hasValidDbKey())
|
||||
if (isDBModel)
|
||||
{
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Found model in DB for model string '%1'").arg(model.getModelStringAndDbKey()));
|
||||
}
|
||||
@@ -708,6 +709,10 @@ namespace BlackCore
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Did not find model in DB for model string '%1'").arg(modelString));
|
||||
}
|
||||
}
|
||||
|
||||
if (!isDBModel) { return CAircraftModel(); } // not found
|
||||
|
||||
// found
|
||||
model.setCallsign(callsign);
|
||||
model.setModelType(CAircraftModel::TypeReverseLookup);
|
||||
return model;
|
||||
@@ -931,6 +936,16 @@ namespace BlackCore
|
||||
return known;
|
||||
}
|
||||
|
||||
bool CAircraftMatcher::isKnownModelString(const QString &candidate, const CCallsign &callsign, CStatusMessageList *log)
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return false; }
|
||||
const bool known = sApp->getWebDataServices()->containsModelString(candidate);
|
||||
static const QString sKnown("Known modelstring '%1'");
|
||||
static const QString sUnknown("Unknown modelstring '%1'");
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, known ? sKnown.arg(candidate) : sUnknown.arg(candidate));
|
||||
return known;
|
||||
}
|
||||
|
||||
CAircraftIcaoCode CAircraftMatcher::searchAmongAirlineAircraft(const QString &candidateString, const CAirlineIcaoCode &airline, const CCallsign &callsign, CStatusMessageList *log)
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftIcaoCode(); }
|
||||
|
||||
@@ -205,6 +205,9 @@ namespace BlackCore
|
||||
const QString &candidate, const BlackMisc::Aviation::CCallsign &callsign = {},
|
||||
BlackMisc::CStatusMessageList *log = nullptr);
|
||||
|
||||
//! Is this aircraft designator known?
|
||||
//! \threadsafe
|
||||
static bool isKnownModelString(
|
||||
const QString &candidate, const BlackMisc::Aviation::CCallsign &callsign = {},
|
||||
BlackMisc::CStatusMessageList *log = nullptr);
|
||||
|
||||
|
||||
@@ -708,10 +708,17 @@ namespace BlackCore
|
||||
const ReverseLookupLogging reverseLookupEnabled = this->isReverseLookupMessagesEnabled();
|
||||
CStatusMessageList reverseLookupMessages;
|
||||
CStatusMessageList *pReverseLookupMessages = reverseLookupEnabled.testFlag(RevLogEnabled) ? &reverseLookupMessages : nullptr;
|
||||
if (!CAircraftMatcher::isKnownModelString(modelString, callsign, pReverseLookupMessages))
|
||||
{
|
||||
// from the T701 test, do NOT use if model string is unknown
|
||||
// this can overrride "swift livery strings", FsInn here only is useful with a known model string
|
||||
CMatchingUtils::addLogDetailsToList(pReverseLookupMessages, callsign,
|
||||
QStringLiteral("FsInn data ignored, as modelstring '%1' is not known").arg(modelString));
|
||||
return;
|
||||
}
|
||||
CMatchingUtils::addLogDetailsToList(pReverseLookupMessages, callsign,
|
||||
QStringLiteral("FsInn data from network: aircraft '%1', airline '%2', model '%3', combined '%4'").
|
||||
arg(aircraftIcaoDesignator, airlineIcaoDesignator, modelString, combinedAircraftType));
|
||||
|
||||
this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, "", modelString, CAircraftModel::TypeFSInnData, pReverseLookupMessages);
|
||||
this->addReverseLookupMessages(callsign, reverseLookupMessages);
|
||||
this->sendReadyForModelMatching(callsign); // from FSInn
|
||||
|
||||
Reference in New Issue
Block a user