overwrite mon rule if exists

This commit is contained in:
vaxerski 2022-04-21 17:33:24 +02:00
parent a0ec0326f9
commit 4b1773d1b1

View File

@ -159,6 +159,14 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
if (curitem == "disable" || curitem == "disabled") { if (curitem == "disable" || curitem == "disabled") {
newrule.disabled = true; newrule.disabled = true;
// overwrite if exists
for (auto& r : m_dMonitorRules) {
if (r.name == newrule.name) {
r = newrule;
return;
}
}
m_dMonitorRules.push_back(newrule); m_dMonitorRules.push_back(newrule);
return; return;
@ -183,6 +191,14 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
newrule.scale = stof(curitem); newrule.scale = stof(curitem);
// overwrite if exists
for (auto& r : m_dMonitorRules) {
if (r.name == newrule.name) {
r = newrule;
return;
}
}
m_dMonitorRules.push_back(newrule); m_dMonitorRules.push_back(newrule);
} }