44 public function readAll(
int $groupId = 0): void
51 $groupsToReset = $groupId === 0
55 $state = Counter\State\Factory::getState($this->userId);
57 foreach ($state as $row)
59 $stateGroupId = (int)$row[
'GROUP_ID'];
60 $stateLogId = (int)$row[
'SONET_LOG_ID'];
62 if ($stateGroupId !== $groupId || $stateLogId === 0)
67 $logItem = Log::getById($row[
'SONET_LOG_ID']);
68 if ($logItem ===
false)
73 $typeId = $logItem->getFields()[
'RATING_TYPE_ID'] ??
null;
74 $entityId = $logItem->getFields()[
'RATING_ENTITY_ID'] ??
null;
76 if (!$typeId || !$entityId)
82 'userId' => $this->userId,
84 'entityId' => $entityId,
85 'logId' => $row[
'SONET_LOG_ID'],
90 self::reset($this->userId, $types, [], $groupsToReset);
91 Counter\State\Factory::reloadState($this->userId);
92 Service::addEvent(EventDictionary::EVENT_SPACE_LIVEFEED_COUNTER_UPD,[
93 'USER_ID' => $this->userId,
116 public function recount(
string $counter, array $logIds = []): void
123 $counters = $this->getUserCollector()->recount($counter, $logIds);
125 $counterTypes = [$counter];
126 self::reset($this->userId, $counterTypes, $logIds);
127 $this->batchInsert($counters);
129 Counter\State\Factory::getState($this->userId)->updateState($counters, $counterTypes, $logIds);
130 Service::addEvent(EventDictionary::EVENT_SPACE_LIVEFEED_COUNTER_UPD,[
131 'USER_ID' => $this->userId,