More detailled validation messages "which models look odd"

This commit is contained in:
Klaus Basan
2019-09-04 22:27:49 +02:00
committed by Mat Sutcliffe
parent decdbb4432
commit 507e059438
3 changed files with 41 additions and 3 deletions

View File

@@ -496,6 +496,13 @@ namespace BlackMisc
});
}
CAircraftModelList CAircraftModelList::findWithoutValidDbKey(int maxElements) const
{
CAircraftModelList ml = this->findWithoutValidDbKey();
ml.truncate(maxElements);
return ml;
}
CAircraftModelList CAircraftModelList::findNonDbModelsForAirline(const QString &airline) const
{
const CAircraftModelList noDb = this->findWithoutValidDbKey();
@@ -523,7 +530,7 @@ namespace BlackMisc
});
}
CAircraftModelList CAircraftModelList::getAllIncludedModels() const
CAircraftModelList CAircraftModelList::findAllIncludedModels() const
{
return this->findBy([](const CAircraftModel & model)
{
@@ -531,6 +538,28 @@ namespace BlackMisc
});
}
CAircraftModelList CAircraftModelList::findAllIncludedModels(int maxElements) const
{
CAircraftModelList ml = this->findAllIncludedModels();
ml.truncate(maxElements);
return ml;
}
CAircraftModelList CAircraftModelList::findAllExcludedModels() const
{
return this->findBy([](const CAircraftModel & model)
{
return model.getModelMode() == CAircraftModel::Exclude;
});
}
CAircraftModelList CAircraftModelList::findAllExcludedModels(int maxElements) const
{
CAircraftModelList ml = this->findAllExcludedModels();
ml.truncate(maxElements);
return ml;
}
CAircraftModelList CAircraftModelList::findDuplicateModelStrings() const
{
const QMap<QString, int> modelStrings = this->countPerModelString();

View File

@@ -266,6 +266,7 @@ namespace BlackMisc
//! With/without DB key @{
CAircraftModelList findWithValidDbKey() const;
CAircraftModelList findWithoutValidDbKey() const;
CAircraftModelList findWithoutValidDbKey(int maxElements) const;
//! @}
//! Some finders for NON DB models, mostly for matching script results @{
@@ -274,8 +275,12 @@ namespace BlackMisc
CAircraftModelList findNonDbModelsForModelString(const QString &modelString) const;
//! @}
//! All included models
CAircraftModelList getAllIncludedModels() const;
//! All included/excluded models @{
CAircraftModelList findAllIncludedModels() const;
CAircraftModelList findAllIncludedModels(int maxElements) const;
CAircraftModelList findAllExcludedModels() const;
CAircraftModelList findAllExcludedModels(int maxElements) const;
//! @}
//! Take a designator and find its family
QString designatorToFamily(const Aviation::CAircraftIcaoCode &aircraftIcaoCode) const;

View File

@@ -154,12 +154,16 @@ namespace BlackMisc
if (noDb > 0)
{
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("%1 models without DB data, is this intended?").arg(noDb), true));
const QString ms = models.findWithoutValidDbKey(5).getModelStringList().join(", ");
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("Some of the non DB models are: '%1'").arg(ms), true));
}
const int noExcluded = models.countByMode(CAircraftModel::Exclude);
if (noExcluded > 0)
{
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("%1 models marked as excluded, is this intended?").arg(noExcluded), true));
const QString ms = models.findAllExcludedModels(5).getModelStringList().join(", ");
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("Some of the excluded models are: '%1'").arg(ms), true));
}
// specific checks for FSX/XPlane/FG