Skip to content

Commit 9ae4fcb

Browse files
NathanielVolfangojenkins
authored andcommitted
QPR-12013 -- Raise warning and skip if duplicate SIMM version found in SIMM calibration
1 parent 4db9ff2 commit 9ae4fcb

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

OREAnalytics/orea/simm/simmcalibration.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -628,38 +628,22 @@ void SimmCalibrationData::add(const boost::shared_ptr<SimmCalibration>& simmCali
628628

629629
// Check for SIMM version name clashes
630630
const auto& incVersionNames = simmCalibration->versionNames();
631-
Size duplicateVersionNames = 0;
632631
for (const auto& [id, sc] : data_) {
633632
for (const string& incName : incVersionNames) {
634-
bool isUnique = true;
635633
for (const string& currName : sc->versionNames()) {
636634
if (incName == currName) {
637-
const string msg = "SIMM calibration being added with version name '" + incName +
638-
"' which already exists. The calibration data may still be added if it has "
639-
"unique version names, but only the "
640-
"first instance for the given alias (i.e. SIMM calibration ID '" +
641-
id + "') will be used for SIMM calculations using SIMM version '" + incName +
642-
"'.";
635+
const string msg = "SIMM calibration has duplicate version name '" + incName +
636+
"' (added under calibration id='" + id +
637+
"'). SIMM calibration will not be added.";
643638
ore::data::StructuredConfigurationWarningMessage(configurationType, simmCalibration->id(),
644639
exceptionType, msg)
645640
.log();
646-
isUnique = false;
647-
break;
641+
return;
648642
}
649643
}
650-
if (!isUnique)
651-
duplicateVersionNames++;
652644
}
653645
}
654646

655-
// Only add SIMM calibratoin if it has at least one unique version name
656-
if (duplicateVersionNames == simmCalibration->versionNames().size()) {
657-
const string msg = "SIMM calibration will not be added since all its version names are duplicates and have "
658-
"already been added.";
659-
ore::data::StructuredConfigurationErrorMessage(configurationType, simmCalibration->id(), exceptionType, msg).log();
660-
return;
661-
}
662-
663647
data_[simmCalibration->id()] = simmCalibration;
664648
}
665649

0 commit comments

Comments
 (0)