mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 01:35:45 +08:00
refs #709, as result of testing created special database views for ICAO codes
* view already filter incomplete data * as result, info object count values are aligned with data eventually parsed (which will allow to detect changes by comparing counts) * smaller adjustments to allow airlines with designator
This commit is contained in:
@@ -223,7 +223,7 @@ namespace BlackCore
|
|||||||
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(nwReplyPtr);
|
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(nwReplyPtr);
|
||||||
if (this->isAbandoned()) { return; }
|
if (this->isAbandoned()) { return; }
|
||||||
|
|
||||||
QString urlString(nwReply->url().toString());
|
const QString urlString(nwReply->url().toString());
|
||||||
CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data());
|
CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data());
|
||||||
if (res.hasErrorMessage())
|
if (res.hasErrorMessage())
|
||||||
{
|
{
|
||||||
@@ -231,7 +231,9 @@ namespace BlackCore
|
|||||||
emit dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const CAircraftIcaoCodeList codes = CAircraftIcaoCodeList::fromDatabaseJson(res);
|
|
||||||
|
// normally read from special view which already filter incomplete
|
||||||
|
const CAircraftIcaoCodeList codes = CAircraftIcaoCodeList::fromDatabaseJson(res, false);
|
||||||
const int n = codes.size();
|
const int n = codes.size();
|
||||||
qint64 latestTimestamp = codes.latestTimestampMsecsSinceEpoch();
|
qint64 latestTimestamp = codes.latestTimestampMsecsSinceEpoch();
|
||||||
if (n > 0 && latestTimestamp < 0)
|
if (n > 0 && latestTimestamp < 0)
|
||||||
@@ -259,7 +261,7 @@ namespace BlackCore
|
|||||||
emit dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFailed, 0);
|
emit dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFailed, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const CAirlineIcaoCodeList codes = CAirlineIcaoCodeList::fromDatabaseJson(res);
|
const CAirlineIcaoCodeList codes = CAirlineIcaoCodeList::fromDatabaseJson(res, false);
|
||||||
const int n = codes.size();
|
const int n = codes.size();
|
||||||
qint64 latestTimestamp = codes.latestTimestampMsecsSinceEpoch();
|
qint64 latestTimestamp = codes.latestTimestampMsecsSinceEpoch();
|
||||||
if (n > 0 && latestTimestamp < 0)
|
if (n > 0 && latestTimestamp < 0)
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ namespace BlackMisc
|
|||||||
QString CAircraftIcaoCode::getCombinedIcaoStringWithKey() const
|
QString CAircraftIcaoCode::getCombinedIcaoStringWithKey() const
|
||||||
{
|
{
|
||||||
QString s(getDesignator());
|
QString s(getDesignator());
|
||||||
|
if (s.isEmpty()) s = "????";
|
||||||
if (hasManufacturer()) { s = s.append(" ").append(getManufacturer()); }
|
if (hasManufacturer()) { s = s.append(" ").append(getManufacturer()); }
|
||||||
if (hasModelDescription()) { s = s.append(" ").append(getModelDescription()); }
|
if (hasModelDescription()) { s = s.append(" ").append(getModelDescription()); }
|
||||||
return s.append(" ").append(getDbKeyAsStringInParentheses());
|
return s.append(" ").append(getDbKeyAsStringInParentheses());
|
||||||
|
|||||||
@@ -199,7 +199,10 @@ namespace BlackMisc
|
|||||||
for (const QJsonValue &value : array)
|
for (const QJsonValue &value : array)
|
||||||
{
|
{
|
||||||
CAircraftIcaoCode icao(CAircraftIcaoCode::fromDatabaseJson(value.toObject()));
|
CAircraftIcaoCode icao(CAircraftIcaoCode::fromDatabaseJson(value.toObject()));
|
||||||
if (ignoreIncomplete && !icao.hasSpecialDesignator() && !icao.hasCompleteData()) { continue; }
|
if (ignoreIncomplete && !icao.hasSpecialDesignator() && !icao.hasCompleteData())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
codes.push_back(icao);
|
codes.push_back(icao);
|
||||||
}
|
}
|
||||||
return codes;
|
return codes;
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ namespace BlackMisc
|
|||||||
QString CAirlineIcaoCode::getCombinedStringWithKey() const
|
QString CAirlineIcaoCode::getCombinedStringWithKey() const
|
||||||
{
|
{
|
||||||
QString s(getVDesignator());
|
QString s(getVDesignator());
|
||||||
|
if (s.isEmpty()) s = "????";
|
||||||
if (hasName()) { s = s.append(" ").append(getName()); }
|
if (hasName()) { s = s.append(" ").append(getName()); }
|
||||||
return s.append(" ").append(getDbKeyAsStringInParentheses());
|
return s.append(" ").append(getDbKeyAsStringInParentheses());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,10 @@ namespace BlackMisc
|
|||||||
for (const QJsonValue &value : array)
|
for (const QJsonValue &value : array)
|
||||||
{
|
{
|
||||||
const CAirlineIcaoCode icao(CAirlineIcaoCode::fromDatabaseJson(value.toObject()));
|
const CAirlineIcaoCode icao(CAirlineIcaoCode::fromDatabaseJson(value.toObject()));
|
||||||
if (ignoreIncomplete && !icao.hasCompleteData()) { continue; }
|
if (ignoreIncomplete && !icao.hasCompleteData())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
codes.push_back(icao);
|
codes.push_back(icao);
|
||||||
}
|
}
|
||||||
return codes;
|
return codes;
|
||||||
@@ -158,7 +161,7 @@ namespace BlackMisc
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QString d(icao.getDesignator());
|
const QString d(icao.getDesignator());
|
||||||
if (c.contains(d)) { continue; }
|
if (c.contains(d) || d.isEmpty()) { continue; }
|
||||||
c.append(d);
|
c.append(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user