mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
Ref T104, return inconsistent airports
This commit is contained in:
committed by
Mathew Sutcliffe
parent
297c2f0539
commit
847fcfbb71
@@ -10,8 +10,9 @@
|
||||
#include "airportdatareader.h"
|
||||
#include "blackcore/db/databaseutils.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include <QNetworkReply>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -159,16 +160,23 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
CAirportList airports;
|
||||
CAirportList inconsistent;
|
||||
if (res.isRestricted())
|
||||
{
|
||||
const CAirportList incAirports(CAirportList::fromDatabaseJson(res));
|
||||
if (incAirports.isEmpty()) { return; } // currently ignored
|
||||
const CAirportList incrementalAirports(CAirportList::fromDatabaseJson(res, &inconsistent));
|
||||
if (incrementalAirports.isEmpty()) { return; } // currently ignored
|
||||
airports = this->getAirports();
|
||||
airports.replaceOrAddObjectsByKey(incAirports);
|
||||
airports.replaceOrAddObjectsByKey(incrementalAirports);
|
||||
}
|
||||
else
|
||||
{
|
||||
airports = CAirportList::fromDatabaseJson(res);
|
||||
airports = CAirportList::fromDatabaseJson(res, &inconsistent);
|
||||
}
|
||||
|
||||
if (!inconsistent.isEmpty())
|
||||
{
|
||||
BLACK_AUDIT_X(false, Q_FUNC_INFO, "Inconsistent aircraft codes");
|
||||
CLogMessage(this).warning("Inconsistent airports: %1") << inconsistent.dbKeysAsStrings(", ");
|
||||
}
|
||||
|
||||
const int size = airports.size();
|
||||
|
||||
@@ -339,10 +339,10 @@ namespace BlackCore
|
||||
if (res.isRestricted())
|
||||
{
|
||||
// create full list if it was just incremental
|
||||
const CCountryList incCountries(CCountryList::fromDatabaseJson(res));
|
||||
if (incCountries.isEmpty()) { return; } // currently ignored
|
||||
const CCountryList incrementalCountries(CCountryList::fromDatabaseJson(res));
|
||||
if (incrementalCountries.isEmpty()) { return; } // currently ignored
|
||||
countries = this->getCountries();
|
||||
countries.replaceOrAddObjectsByKey(incCountries);
|
||||
countries.replaceOrAddObjectsByKey(incrementalCountries);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user