refs #571, consolidate with own models or DB models when stashed (goal: better defaults)

* improved missing parts updates
* sync. with own and DB models
This commit is contained in:
Klaus Basan
2016-01-12 01:21:26 +01:00
parent 9f646f215c
commit 6625b83c5e
9 changed files with 130 additions and 35 deletions

View File

@@ -225,6 +225,16 @@ namespace BlackMisc
void CAirlineIcaoCode::updateMissingParts(const CAirlineIcaoCode &otherIcaoCode)
{
if (!this->hasValidDbKey() && otherIcaoCode.hasValidDbKey())
{
// we have no DB data, but the other one has
// so we change roles. We take the DB object as base, and update our parts
CAirlineIcaoCode copy(otherIcaoCode);
copy.updateMissingParts(*this);
*this = copy;
return;
}
if (!this->hasValidDesignator()) { this->setDesignator(otherIcaoCode.getDesignator()); }
if (!this->hasValidCountry()) { this->setCountry(otherIcaoCode.getCountry()); }
if (!this->hasName()) { this->setName(otherIcaoCode.getName()); }