mirror of https://github.com/nymea/nymea.git
Update removeConfiguredDevice to update rules as appropriate
parent
6afe3e5161
commit
5fcfe1a11c
|
|
@ -809,6 +809,15 @@ QList<RuleId> RuleEngine::findRules(const DeviceId &deviceId) const
|
||||||
offending = true;
|
offending = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
foreach (const RuleActionParam &ruleActionParam, action.ruleActionParams()) {
|
||||||
|
if (ruleActionParam.stateDeviceId() == deviceId) {
|
||||||
|
offending = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (offending) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -818,6 +827,15 @@ QList<RuleId> RuleEngine::findRules(const DeviceId &deviceId) const
|
||||||
offending = true;
|
offending = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
foreach (const RuleActionParam &ruleActionParam, action.ruleActionParams()) {
|
||||||
|
if (ruleActionParam.stateDeviceId() == deviceId) {
|
||||||
|
offending = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (offending) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -886,6 +904,13 @@ void RuleEngine::removeDeviceFromRule(const RuleId &id, const DeviceId &deviceId
|
||||||
for (int i = 0; i < actions.count(); i++) {
|
for (int i = 0; i < actions.count(); i++) {
|
||||||
if (actions.at(i).deviceId() == deviceId) {
|
if (actions.at(i).deviceId() == deviceId) {
|
||||||
removeIndexes.append(i);
|
removeIndexes.append(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (const RuleActionParam ¶m, actions.at(i).ruleActionParams()) {
|
||||||
|
if (param.stateDeviceId() == deviceId) {
|
||||||
|
removeIndexes.append(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (removeIndexes.count() > 0) {
|
while (removeIndexes.count() > 0) {
|
||||||
|
|
@ -897,6 +922,13 @@ void RuleEngine::removeDeviceFromRule(const RuleId &id, const DeviceId &deviceId
|
||||||
for (int i = 0; i < exitActions.count(); i++) {
|
for (int i = 0; i < exitActions.count(); i++) {
|
||||||
if (exitActions.at(i).deviceId() == deviceId) {
|
if (exitActions.at(i).deviceId() == deviceId) {
|
||||||
removeIndexes.append(i);
|
removeIndexes.append(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (const RuleActionParam ¶m, exitActions.at(i).ruleActionParams()) {
|
||||||
|
if (param.stateDeviceId() == deviceId) {
|
||||||
|
removeIndexes.append(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (removeIndexes.count() > 0) {
|
while (removeIndexes.count() > 0) {
|
||||||
|
|
@ -1464,7 +1496,6 @@ void RuleEngine::init()
|
||||||
param.setStateDeviceId(stateDeviceId);
|
param.setStateDeviceId(stateDeviceId);
|
||||||
param.setStateTypeId(stateTypeId);
|
param.setStateTypeId(stateTypeId);
|
||||||
params.append(param);
|
params.append(param);
|
||||||
params.append(param);
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@ private slots:
|
||||||
|
|
||||||
void testHousekeeping_data();
|
void testHousekeeping_data();
|
||||||
void testHousekeeping();
|
void testHousekeeping();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void TestRules::cleanupMockHistory() {
|
void TestRules::cleanupMockHistory() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue