mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
refs #576, no airline validation with color liveries and no exclusion of special designators
This commit is contained in:
@@ -98,6 +98,12 @@ namespace BlackMisc
|
||||
return (this->hasValidDesignator() && this->getDesignator() != getUnassignedDesignator());
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::hasSpecialDesignator() const
|
||||
{
|
||||
if (!this->hasDesignator()) { return false; }
|
||||
return getSpecialDesignators().contains(this->getDesignator());
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::isIataSameAsDesignator() const
|
||||
{
|
||||
return hasDesignator() && hasIataCode() && m_iataCode == m_designator;
|
||||
|
||||
@@ -78,6 +78,9 @@ namespace BlackMisc
|
||||
//! Has designator and designator is not "ZZZZ"
|
||||
bool hasKnownDesignator() const;
|
||||
|
||||
//! Special designator
|
||||
bool hasSpecialDesignator() const;
|
||||
|
||||
//! IATA code
|
||||
const QString &getIataCode() const { return m_iataCode; }
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace BlackMisc
|
||||
for (const QJsonValue &value : array)
|
||||
{
|
||||
CAircraftIcaoCode icao(CAircraftIcaoCode::fromDatabaseJson(value.toObject()));
|
||||
if (ignoreIncomplete && !icao.hasCompleteData()) { continue; }
|
||||
if (ignoreIncomplete && !icao.hasSpecialDesignator() && !icao.hasCompleteData()) { continue; }
|
||||
codes.push_back(icao);
|
||||
}
|
||||
return codes;
|
||||
|
||||
@@ -115,7 +115,18 @@ namespace BlackMisc
|
||||
if (!hasCombinedCode()) { msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, "Livery: missing livery code")); }
|
||||
if (!hasColorFuselage()) { msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, "Livery: no fuselage color")); }
|
||||
if (!hasColorTail()) { msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, "Livery: no tail color")); }
|
||||
if (!getAirlineIcaoCodeDesignator().isEmpty()) { msg.push_back(m_airline.validate()); }
|
||||
if (this->isColorLivery())
|
||||
{
|
||||
if (!this->getAirlineIcaoCodeDesignator().isEmpty())
|
||||
{
|
||||
// color livery, supposed to have empty airline
|
||||
msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, "Livery: color livery, but airline looks odd"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.push_back(m_airline.validate());
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,11 @@ namespace BlackMisc
|
||||
if (!model.getDistributor().hasValidDbKey()) { subMsgs << "No distributor from DB"; }
|
||||
if (!model.getAircraftIcaoCode().hasValidDbKey()) { subMsgs << "No aircraft ICAO from DB"; }
|
||||
if (!model.getLivery().hasValidDbKey()) { subMsgs << "No livery from DB"; }
|
||||
if (!model.getLivery().getAirlineIcaoCode().hasValidDbKey()) { subMsgs << "No airline ICAO from DB"; }
|
||||
if (model.getLivery().isAirlineLivery())
|
||||
{
|
||||
// for color codes we do not need to check
|
||||
if (!model.getLivery().getAirlineIcaoCode().hasValidDbKey()) { subMsgs << "No airline ICAO from DB"; }
|
||||
}
|
||||
CStatusMessage msgDb(CStatusMessage::SeverityError, subMsgs.join(", "));
|
||||
|
||||
CStatusMessage singleMsg(CStatusMessageList({msgModel, msgDb}).toSingleMessage());
|
||||
|
||||
Reference in New Issue
Block a user