diff --git a/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.html b/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.html index d29251c9d5..bd0592f71f 100644 --- a/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.html +++ b/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.html @@ -37,11 +37,14 @@
Leaderboard
No phase selected.
-
- B - Baseline submission - - P - Private submission - +
+
+ + B - Baseline submission + + + P - Private submission + - - - +
+ + +
@@ -161,7 +165,7 @@
Leaderboard
P - +   diff --git a/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.scss b/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.scss index db29d04840..773ec59a36 100644 --- a/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.scss +++ b/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.scss @@ -79,6 +79,11 @@ } } +.pull-right { + margin-left: auto; + margin-top: -3%; +} + .btn-switch { position: relative; display: block; diff --git a/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.ts b/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.ts index 2f31cd79a6..2f9815aa8e 100644 --- a/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.ts +++ b/frontend_v2/src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.ts @@ -144,6 +144,11 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD */ getAllEntries = false; + /** + * Number of entries on complete leaderboard + */ + numberOfAllEntries:number = 0; + /** * Current state of whether private leaderboard */ @@ -336,8 +341,10 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD phaseSplitSelected(phaseSplit) { const SELF = this; SELF.selectedPhaseSplit = phaseSplit; + + SELF.fetchNumberOfAllEnteriesOnPublicLeaderboard(SELF.selectedPhaseSplit['id']); - const API_PATH = SELF.endpointsService.particularChallengePhaseSplitUrl(this.selectedPhaseSplit['id']); + const API_PATH = SELF.endpointsService.particularChallengePhaseSplitUrl(SELF.selectedPhaseSplit['id']); SELF.apiService.getUrl(API_PATH).subscribe( (data) => { SELF.leaderboardPrecisionValue = data.leaderboard_decimal_precision; @@ -350,7 +357,11 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD ); if (SELF.selectedPhaseSplit && SELF.router.url.endsWith('leaderboard/' + phaseSplit['id'])) { - SELF.fetchLeaderboard(SELF.selectedPhaseSplit['id']); + if(SELF.getAllEntriesTextOption == 'Exclude private submissions') { + SELF.fetchAllEnteriesOnPublicLeaderboard(SELF.selectedPhaseSplit['id']); + } else { + SELF.fetchLeaderboard(SELF.selectedPhaseSplit['id']); + } SELF.showLeaderboardByLatest = SELF.selectedPhaseSplit.show_leaderboard_by_latest_submission; SELF.sortLeaderboardTextOption = SELF.showLeaderboardByLatest ? 'Sort by best' : 'Sort by latest'; let selectedPhase = SELF.phases.find((phase) => { @@ -507,6 +518,24 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD ); } + /** + * Fetch number of entries of complete leaderboard for a phase split public/private + * @param phaseSplitId id of the phase split + */ + fetchNumberOfAllEnteriesOnPublicLeaderboard(phaseSplitId) { + const API_PATH = this.endpointsService.challengeCompleteLeaderboardURL(phaseSplitId); + const SELF = this; + this.apiService.getUrl(API_PATH).subscribe( + (data) => { + this.numberOfAllEntries = data['results'].length; + }, + (err) => { + SELF.globalService.handleApiError(err); + }, + () => {} + ); + } + /** * function for toggeling between public leaderboard and complete leaderboard [public/private] */ @@ -526,7 +555,12 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD * @param phaseSplitId id of the phase split */ startLeaderboard(phaseSplitId) { - const API_PATH = this.endpointsService.challengeLeaderboardURL(phaseSplitId); + let API_PATH; + if(this.getAllEntriesTextOption == 'Exclude private submissions') { + API_PATH = this.endpointsService.challengeCompleteLeaderboardURL(phaseSplitId); + } else { + API_PATH = this.endpointsService.challengeLeaderboardURL(phaseSplitId); + } const SELF = this; clearInterval(SELF.pollingInterval); SELF.pollingInterval = setInterval(function () {