Skip to content

Commit

Permalink
[Hide->Show] Implement Tobi his feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Sep 1, 2023
1 parent bebe323 commit 119859e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions etc/db-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@
default_value: false
public: true
description: Show canonical compiler and runner version on the team pages.
- name: hide_teams_scoreboard_condition
- name: show_teams_on_scoreboard
type: int
default_value: 0
public: true
description: Hide teams on the scoreboard?
description: Show teams on the scoreboard?
options:
0: never
1: when never logged in
2: when didn't submit
0: Always
1: After login
2: After first submission
- category: Authentication
description: Options related to authentication.
items:
Expand Down
12 changes: 6 additions & 6 deletions webapp/src/Service/ScoreboardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

class ScoreboardService
{
final public const HIDE_TEAM_NEVER = 0;
final public const HIDE_TEAM_NO_LOGIN = 1;
final public const HIDE_TEAM_NO_SUBMIT = 2;
final public const SHOW_TEAM_ALWAYS = 0;
final public const SHOW_TEAM_AFTER_LOGIN = 1;
final public const SHOW_TEAM_AFTER_SUBMIT = 2;

public function __construct(
protected readonly EntityManagerInterface $em,
Expand Down Expand Up @@ -948,13 +948,13 @@ protected function getTeams(Contest $contest, bool $jury = false, Filter $filter
->setParameter('cid', $contest->getCid());
}

$hide_filter = $this->config->get('hide_teams_scoreboard_condition');
$show_filter = $this->config->get('show_teams_scoreboard');
if (!$jury) {
$queryBuilder->andWhere('tc.visible = 1');
if ($hide_filter === self::HIDE_TEAM_NO_LOGIN) {
if ($show_filter === self::SHOW_TEAM_AFTER_LOGIN) {
$queryBuilder
->join('t.users', 'u', Join::WITH, 'u.last_login IS NOT NULL');
} elseif ($hide_filter === self::HIDE_TEAM_NO_SUBMIT) {
} elseif ($show_filter === self::SHOW_TEAM_AFTER_SUBMIT) {
$queryBuilder
->join('t.submissions', 's', Join::WITH, 's.contest = :cid')
->setParameter('cid', $contest->getCid());
Expand Down
12 changes: 6 additions & 6 deletions webapp/tests/Unit/Integration/ScoreboardIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ protected function setUp(): void

// Default configuration values:
$this->configValues = [
'verification_required' => false,
'compile_penalty' => false,
'penalty_time' => 20,
'score_in_seconds' => false,
'data_source' => 0,
'hide_teams_scoreboard_condition' => 0,
'verification_required' => false,
'compile_penalty' => false,
'penalty_time' => 20,
'score_in_seconds' => false,
'data_source' => 0,
'show_teams_on_scoreboard' => 0,
];

$this->config = $this->createMock(ConfigurationService::class);
Expand Down

0 comments on commit 119859e

Please sign in to comment.