Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions webapp/src/Controller/Jury/ClarificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,26 @@ public function indexAction(
->setParameter('queue', $currentQueue);
}

$clarifications = $queryBuilder
->getQuery()
->getResult();

/** @var Clarification[] $newClarifications */
$newClarifications = [];
/** @var Clarification[] $oldClarifications */
$oldClarifications = [];
/** @var Clarification[] $generalClarifications */
$generalClarifications = [];
$wheres = [
'new' => 'clar.sender IS NOT NULL AND clar.answered = 0',
'old' => 'clar.sender IS NOT NULL AND clar.answered != 0',
'general' => 'clar.sender IS NULL AND clar.in_reply_to IS NULL',
];
foreach ($wheres as $type => $where) {
$clarifications = (clone $queryBuilder)
->andWhere($where)
->getQuery()
->getResult();

switch ($type) {
case 'new':
$newClarifications = $clarifications;
break;
case 'old':
$oldClarifications = $clarifications;
break;
case 'general':
$generalClarifications = $clarifications;
break;

foreach ($clarifications as $clar) {
if ($clar->getSender() !== null) {
if ($clar->getAnswered()) {
$oldClarifications[] = $clar;
} else {
$newClarifications[] = $clar;
}
} elseif ($clar->getInReplyTo() === null) {
$generalClarifications[] = $clar;
}
}

Expand Down
Loading