-
Notifications
You must be signed in to change notification settings - Fork 279
feat: add submission notification #3018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -322,6 +322,53 @@ public function getUnreadClarifications(): array | |
| return $unreadClarifications; | ||
| } | ||
|
|
||
| /** | ||
| * @return array<array{submissionid: int, judgingid: int, result: string}> | ||
| */ | ||
|
|
||
| public function getUnreadJudgements(): array | ||
| { | ||
| $user = $this->getUser(); | ||
| $team = $user->getTeam(); | ||
| $contest = $this->getCurrentContest($team->getTeamId()); | ||
| $unreadJudgements = []; | ||
| if ($contest === null) { | ||
| return $unreadJudgements; | ||
| } | ||
|
|
||
| $queryBuilder = $this->em->createQueryBuilder() | ||
| ->from(Judging::class, 'j') | ||
| ->select('j, c, s') | ||
| ->leftJoin('j.contest', 'c') | ||
| ->leftJoin('j.submission', 's') | ||
| ->groupBy('j.judgingid') | ||
| ->orderBy('j.judgingid') | ||
| ->andWhere('j.contest = :cid') | ||
| ->setParameter('cid', $contest->getCid()) | ||
| ->andWhere('j.result IS NOT NULL') | ||
| ->andWhere('s.team = :team') | ||
| ->setParameter('team', $team) | ||
| ->andWhere('s.submittime < c.endtime') | ||
| ->andWhere('j.valid = 1') | ||
| ->andWhere('j.seen = 0'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a migration missing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. domjudge/webapp/src/Entity/Judging.php Lines 118 to 120 in 4398ae5
#[ORM\Column(options: ['comment' => 'Whether the team has seen this judging', 'default' => 0])]
#[Serializer\Exclude]
private bool $seen = false;
But this may not be important, because the logic of whether to send notifications does not look at this field, (which is at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, this SQL query is the same as the one a user access Therefore, it is also feasible to implement it directly on the frontend js instead of adding a function to the |
||
|
|
||
| if ($this->config->get('verification_required')) { | ||
| $queryBuilder->andWhere('j.verified = 1'); | ||
| } | ||
|
|
||
| /** @var Judging[] $judgings */ | ||
| $judgings = $queryBuilder->getQuery()->getResult(); | ||
|
|
||
| foreach ($judgings as $j) { | ||
| $unreadJudgements[] = [ | ||
| 'submissionid' => $j->getSubmissionId(), | ||
| 'judgingid' => $j->getJudgingid(), | ||
| 'result' => $j->getResult() | ||
| ]; | ||
| } | ||
| return $unreadJudgements; | ||
| } | ||
|
|
||
| /** | ||
| * @return array{clarifications: array<array{clarid: int, body: string}>, | ||
| * judgehosts: array<array{hostname: string, polltime: float}>, | ||
|
|
||