chg: [fast_update] recalculate attribute count + regenerate correlations

pull/9432/head
iglocska 2023-11-23 09:14:58 +01:00
parent b82093bfe3
commit babf2b73b0
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 18 additions and 0 deletions

View File

@ -2888,6 +2888,24 @@ class Attribute extends AppModel
$this->AttributeTag->deleteAll($conditions, false);
}
}
if ($this->fast_update) {
// Let's recorrelate the event
$this->Corrleation->generateCorrelation(false, $event['Event']['id']);
// Instead of incrementing / decrementing the event
$attribute_count = $this->find('count', [
'conditions' => [
'Attribute.event_id' => $event['Event']['id'],
'Attribute.deleted' => 0
],
'recursive' => -1
]);
$temp_event = [
'id' => $event['Event']['id'],
'attribute_count' => $attribute_count
];
$this->Event->save($temp_event);
$this->__alterAttributeCount($event['Event']['id']);
}
return true;
}