diff --git a/models/db/VotingBlock.php b/models/db/VotingBlock.php index 522ffb1336..f481ebc890 100644 --- a/models/db/VotingBlock.php +++ b/models/db/VotingBlock.php @@ -5,6 +5,7 @@ use app\components\UrlHelper; use app\models\exceptions\Internal; use app\models\majorityType\IMajorityType; +use app\plugins\european_youth_forum\VotingHelper; use app\models\policies\{IPolicy, LoggedIn}; use app\models\quorumType\{IQuorumType, NoQuorum}; use app\models\settings\{AntragsgruenApp, VotingBlock as VotingBlockSettings}; @@ -661,13 +662,15 @@ public function getVotingItemBlocks(bool $includeUngrouped, ?IMotion $adhocFilte } /** - * @return array{votes: int, users: int, abstentions: int} + * @return array{votes: int, users: int, abstentions: int, abstentions_ingyo: int, abstentions_nyc: int} */ public function getVoteStatistics(): array { $total = 0; $voteUserIds = []; $abstainedUserIds = []; + $abstainedUserIdsNyc = []; + $abstainedUserIdsIngyo = []; $groupsMyMotionIds = []; $groupsMyAmendmentIds = []; @@ -694,6 +697,12 @@ public function getVoteStatistics(): array foreach ($this->votes as $vote) { if ($vote->questionId !== null && $vote->questionId === $abstentionId) { $abstainedUserIds[] = $vote->userId; + if ($vote->getUser() && VotingHelper::userIsNyc($this->consultation, $vote->getUser())) { + $abstainedUserIdsNyc[] = $vote->userId; + } + if ($vote->getUser() && VotingHelper::userIsIngyo($this->consultation, $vote->getUser())) { + $abstainedUserIdsIngyo[] = $vote->userId; + } if ($vote->userId && !in_array($vote->userId, $voteUserIds)) { $voteUserIds[] = $vote->userId; } @@ -724,7 +733,13 @@ public function getVoteStatistics(): array } } - return ['votes' => $total, 'users' => count($voteUserIds), 'abstentions' => count($abstainedUserIds)]; + return [ + 'votes' => $total, + 'users' => count($voteUserIds), + 'abstentions' => count($abstainedUserIds), + 'abstentions_nyc' => count($abstainedUserIdsNyc), + 'abstentions_ingyo' => count($abstainedUserIdsIngyo), + ]; } /** diff --git a/models/proposedProcedure/AgendaVoting.php b/models/proposedProcedure/AgendaVoting.php index 72d679597b..4314d7c33b 100644 --- a/models/proposedProcedure/AgendaVoting.php +++ b/models/proposedProcedure/AgendaVoting.php @@ -163,6 +163,8 @@ private function getApiObject(?string $title, ?User $user, string $context): arr $votingBlockJson['votes_total'] = $stats['votes']; $votingBlockJson['votes_users'] = $stats['users']; $votingBlockJson['abstentions_total'] = $stats['abstentions']; + $votingBlockJson['abstentions_nyc'] = $stats['abstentions_nyc']; + $votingBlockJson['abstentions_ingyo'] = $stats['abstentions_ingyo']; $votingBlockJson['vote_policy'] = $this->voting->getVotingPolicy()->getApiObject(); $quorumType = $this->voting->getQuorumType(); diff --git a/views/voting/admin-votings.vue.php b/views/voting/admin-votings.vue.php index 87b6bbecd8..2a8aa55aa6 100644 --- a/views/voting/admin-votings.vue.php +++ b/views/voting/admin-votings.vue.php @@ -680,11 +680,15 @@ class="glyphicon glyphicon-new-window" aria-label="