Skip to content
This repository was archived by the owner on Jul 6, 2020. It is now read-only.

Commit f7a3f7d

Browse files
committed
resolve conflict
2 parents b579d93 + 99b8f4d commit f7a3f7d

18 files changed

+376
-81
lines changed

src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
<mat-chip-list>
6262
<mat-chip>B</mat-chip> - Baseline submission
6363
</mat-chip-list>
64+
<mat-chip-list class="leaderboard-description-span">
65+
<b><span class="leaderboard-description">*</span></b> - Private submission
66+
</mat-chip-list>
6467
<mat-chip-list class="pull-right" *ngIf="isChallengeHost">
6568
<div (click)="showLeaderboardByLatestOrBest()" class="btn-switch sort-leaderboard-switch" [ngClass]="{'btn-switch--on':showLeaderboardByLatest}"
6669
[(ngModel)]="showLeaderboardByLatest" ngDefaultControl>
@@ -69,6 +72,11 @@
6972
</div>
7073
<span class="w-400"> {{sortLeaderboardTextOption}}</span>
7174
</mat-chip-list>
75+
<mat-checkbox class="pull-right complete-leaderboard" *ngIf="isChallengeHost && showLeaderboardToggle"
76+
(change)="toggleLeaderboard(getAllEntries)"
77+
[(ngModel)]="getAllEntries">
78+
<label class="w-400 complete-leaderboard-text"> {{getAllEntriesTextOption}}</label>
79+
</mat-checkbox>
7280
</div>
7381

7482
<table *ngIf="leaderboard.length > 0 && selectedPhaseSplit" class="centered highlight">
@@ -125,6 +133,7 @@
125133
<tr *ngFor="let key of leaderboard" class="content">
126134
<td>{{initial_ranking[key.submission__participant_team__team_name]}}</td>
127135
<td class="fw-regular">{{key.submission__participant_team__team_name}}
136+
<b><span *ngIf="key.submission__is_public === false" class="orange-text">*</span></b>
128137
<span *ngIf="key.submission__is_baseline">
129138
<mat-chip-list>
130139
<mat-chip>B</mat-chip>

src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,25 @@ mat-slider {
145145
display:block;
146146
}
147147

148+
.complete-leaderboard {
149+
margin-right: 2%;
150+
}
151+
152+
.leaderboard-description {
153+
color: $yellow !important;
154+
border-radius: 2px !important;
155+
min-height: 25px !important;
156+
}
157+
158+
.leaderboard-description-span {
159+
margin-left: 2%;
160+
}
161+
162+
.complete-leaderboard-text {
163+
font-size: $fs-16;
164+
color: $gray-darker;
165+
}
166+
148167
/*media queries*/
149168

150169
@media only screen and (max-width: $screen-md) {

src/app/components/challenge/challengeleaderboard/challengeleaderboard.component.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit {
6868
*/
6969
phases = [];
7070

71+
/**
72+
* Private phases list
73+
*/
74+
showPrivateIds = [];
75+
7176
/**
7277
* Phase split list
7378
*/
@@ -113,6 +118,16 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit {
113118
*/
114119
showLeaderboardByLatest = false;
115120

121+
/**
122+
* Current state of whether complete leaderboard
123+
*/
124+
getAllEntries = false;
125+
126+
/**
127+
* Current state of whether private leaderboard
128+
*/
129+
showLeaderboardToggle = true;
130+
116131
/**
117132
* Sort leaderboard based on this column
118133
*/
@@ -123,6 +138,11 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit {
123138
*/
124139
sortLeaderboardTextOption: string;
125140

141+
/**
142+
* Text option for complete leadeboard
143+
*/
144+
getAllEntriesTextOption = 'Include private submissions';
145+
126146
/**
127147
* Reverse sort flag
128148
*/
@@ -211,6 +231,7 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit {
211231
for (let i = 0; i < this.phaseSplits.length; i++) {
212232
if (this.phaseSplits[i].visibility !== this.challengePhaseVisibility.public) {
213233
this.phaseSplits[i].showPrivate = true;
234+
this.showPrivateIds.push(this.phaseSplits[i].id);
214235
}
215236
}
216237
this.filteredPhaseSplits = this.phaseSplits;
@@ -389,6 +410,31 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit {
389410
fetchLeaderboard(phaseSplitId) {
390411
const API_PATH = this.endpointsService.challengeLeaderboardURL(phaseSplitId);
391412
const SELF = this;
413+
SELF.showPrivateIds.forEach(id => {
414+
(id === phaseSplitId) ? ( SELF.showLeaderboardToggle = false) : (SELF.showLeaderboardToggle = true);
415+
});
416+
clearInterval(SELF.pollingInterval);
417+
SELF.leaderboard = [];
418+
SELF.showLeaderboardUpdate = false;
419+
this.apiService.getUrl(API_PATH).subscribe(
420+
data => {
421+
SELF.updateLeaderboardResults(data['results'], SELF);
422+
SELF.startLeaderboard(phaseSplitId);
423+
},
424+
err => {
425+
SELF.globalService.handleApiError(err);
426+
},
427+
() => {}
428+
);
429+
}
430+
431+
/**
432+
* Fetch complete leaderboard for a phase split public/private
433+
* @param phaseSplitId id of the phase split
434+
*/
435+
fetchAllEnteriesOnPublicLeaderboard(phaseSplitId) {
436+
const API_PATH = this.endpointsService.challengeCompleteLeaderboardURL(phaseSplitId);
437+
const SELF = this;
392438
clearInterval(SELF.pollingInterval);
393439
SELF.leaderboard = [];
394440
SELF.showLeaderboardUpdate = false;
@@ -405,6 +451,19 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit {
405451
);
406452
}
407453

454+
// function for toggeling between public leaderboard and complete leaderboard [public/private]
455+
toggleLeaderboard(getAllEntries) {
456+
console.log(getAllEntries);
457+
this.getAllEntries = getAllEntries;
458+
if (getAllEntries) {
459+
this.getAllEntriesTextOption = 'Exclude private submissions';
460+
this.fetchAllEnteriesOnPublicLeaderboard(this.selectedPhaseSplitId);
461+
} else {
462+
this.getAllEntriesTextOption = 'Include private submissions';
463+
this.fetchLeaderboard(this.selectedPhaseSplitId);
464+
}
465+
}
466+
408467
/**
409468
* Call leaderboard API in the interval of 5 seconds
410469
* @param phaseSplitId id of the phase split

src/app/components/challenge/challengephases/editphasemodal/editphasemodal.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
[name]="'max_submissions_per_day'" [isRequired]="true"
6060
[label]="'max_submissions_per_day'" [placeholder]="''"
6161
[type]="'number'" [value]="maxSubmissionsPerDay" #formmodal></app-input>
62+
<div class="editor-validation-message fs-12"
63+
*ngIf="isPerDaySubmissionFieldMessage">{{perDaySubmisionValidationMessage}}</div>
6264
</div>
6365
</div>
6466

@@ -70,6 +72,8 @@
7072
[name]="'max_submissions'" [isRequired]="true"
7173
[label]="'max_submissions_per_month'" [placeholder]="''"
7274
[type]="'number'" [value]="maxSubmissionsPerMonth" #formmodal></app-input>
75+
<div class="editor-validation-message fs-12"
76+
*ngIf="isPerMonthSubmissionFieldMessage">{{PerMonthSubmissionValidationMessage}}</div>
7377
</div>
7478
</div>
7579

src/app/components/challenge/challengephases/editphasemodal/editphasemodal.component.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,31 @@ export class EditphasemodalComponent implements OnInit {
6464
*/
6565
isEditorFieldMessage = false;
6666

67+
/**
68+
* If per day maximum submission error message
69+
*/
70+
isPerDaySubmissionFieldMessage = false;
71+
72+
/**
73+
* If per month maximum submission error message
74+
*/
75+
isPerMonthSubmissionFieldMessage = false;
76+
6777
/**
6878
* Editor validation message
6979
*/
7080
editorValidationMessage = '';
7181

82+
/**
83+
* per day submission validation message
84+
*/
85+
perDaySubmisionValidationMessage = '';
86+
87+
/**
88+
* Editor validation message
89+
*/
90+
PerMonthSubmissionValidationMessage = '';
91+
7292
/**
7393
* Modal accept button
7494
*/
@@ -165,6 +185,17 @@ export class EditphasemodalComponent implements OnInit {
165185
* Form Validate function.
166186
*/
167187
formValidate() {
188+
this.formComponents.map(val => {
189+
if (val.label === 'max_submissions_per_day') {
190+
this.maxSubmissionsPerDay = parseInt(val.value, 10);
191+
}
192+
if (val.label === 'max_submissions_per_month') {
193+
this.maxSubmissionsPerMonth = parseInt(val.value, 10);
194+
}
195+
if (val.label === 'max_submissions') {
196+
this.maxSubmissions = parseInt(val.value, 10);
197+
}
198+
});
168199
if (this.formComponents.length > 0) {
169200
this.globalService.formValidate(this.formComponents, this.confirmed, this);
170201
} else {
@@ -182,6 +213,18 @@ export class EditphasemodalComponent implements OnInit {
182213
self.editorValidationMessage = 'This field cannot be empty!';
183214
return;
184215
}
216+
if (self.maxSubmissionsPerDay > self.maxSubmissionsPerMonth) {
217+
self.denyCallback();
218+
self.isPerDaySubmissionFieldMessage = true;
219+
self.perDaySubmisionValidationMessage = 'Max number of per day submission cannot be greater than max number of per month submissions';
220+
return;
221+
}
222+
if (self.maxSubmissionsPerMonth > self.maxSubmissions) {
223+
self.denyCallback();
224+
self. isPerMonthSubmissionFieldMessage = true;
225+
self.PerMonthSubmissionValidationMessage = 'Max number of per month submissions cannot be greater than max total submissions';
226+
return;
227+
}
185228
const PARAMS = self.globalService.formFields(self.formComponents);
186229
PARAMS[self.label] = self.description;
187230
self.globalService.hideEditPhaseModal();
Lines changed: 79 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,85 @@
1-
<section class="ev-sm-container ev-view challenge-container">
2-
1+
<section class="ev-sm-container ev-view challenge-container noScroll">
32
<!-- ongoing challenges -->
4-
<div *ngIf="routerPublic.url === allChallengesRoutePathCommon">
5-
<div class="challenge-page-title" id = "ongoing-challenges" ><strong class="text-med-black fs-18">Ongoing Challenges</strong></div>
6-
<div *ngIf="ongoingChallenges.length === 0">None</div>
7-
<div class="row">
8-
<div class="col s12 m3" *ngFor="let challenge of ongoingChallenges">
9-
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge.id]">
10-
<app-challengecard [challenge]="challenge" ></app-challengecard>
11-
</a>
12-
</div>
13-
</div>
14-
</div>
3+
<div *ngIf="routerPublic.url === allChallengesRoutePathCommon" [@.disabled]="true">
4+
<mat-tab-group>
5+
<mat-tab label="Ongoing Challenges ({{ongoingChallenges.length}})">
6+
<div *ngIf="ongoingChallenges.length === 0" class="none">None</div>
7+
<div class="row">
8+
<div class="col s12 m3" *ngFor="let challenge of ongoingChallenges">
9+
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge.id]">
10+
<app-challengecard [challenge]="challenge" ></app-challengecard>
11+
</a>
12+
</div>
13+
</div>
14+
</mat-tab>
1515

16-
<!-- upcoming challenges -->
17-
<div *ngIf="routerPublic.url === allChallengesRoutePathCommon">
18-
<div class="challenge-page-title" ><strong class="text-med-black fs-18">Upcoming Challenges</strong></div>
19-
<div *ngIf="upcomingChallenges.length === 0">None</div>
20-
<div class="row">
21-
<div class="col s12 m3" *ngFor="let challenge of upcomingChallenges">
22-
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge.id]">
23-
<app-challengecard [challenge]="challenge" ></app-challengecard>
24-
</a>
25-
</div>
26-
</div>
27-
</div>
16+
<mat-tab label="Upcoming Challenges ({{ upcomingChallenges.length }})">
17+
<!-- upcoming challenges -->
18+
<div *ngIf="upcomingChallenges.length === 0" class="none">None</div>
19+
<div class="row">
20+
<div class="col s12 m3" *ngFor="let challenge of upcomingChallenges">
21+
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge.id]">
22+
<app-challengecard [challenge]="challenge" ></app-challengecard>
23+
</a>
24+
</div>
25+
</div>
26+
</mat-tab>
2827

29-
<!-- past challenges -->
30-
<div *ngIf="routerPublic.url === allChallengesRoutePathCommon">
31-
<div class="challenge-page-title" ><strong class="text-med-black fs-18">Past Challenges</strong></div>
32-
<div *ngIf="pastChallenges.length === 0">None</div>
33-
<div class="row">
34-
<div class="col s12 m3" *ngFor="let challenge of pastChallenges">
35-
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge.id]">
36-
<app-challengecard [challenge]="challenge" ></app-challengecard>
37-
</a>
38-
</div>
39-
</div>
28+
<mat-tab label="Past Challenges ({{ pastChallenges.length }})">
29+
<!-- past challenges -->
30+
<div *ngIf="pastChallenges.length === 0" class="none">None</div>
31+
<div class="row">
32+
<div class="col s12 m3" *ngFor="let challenge of pastChallenges">
33+
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge.id]">
34+
<app-challengecard [challenge]="challenge" ></app-challengecard>
35+
</a>
36+
</div>
37+
</div>
38+
</mat-tab>
39+
</mat-tab-group >
4040
</div>
41-
42-
43-
<!-- my challenges -->
44-
<div *ngIf="routerPublic.url === myChallengesRoutePathCommon">
45-
<div class="challenge-page-title" id = "ongoing-challenges" ><strong class="text-med-black fs-18">My Hosted Challenges</strong></div>
46-
<div *ngIf="!filteredChallenges.length">
47-
You haven't hosted any challenge. Please <a [routerLink]="hostTeamsRoutePathCommon" class="highlight-link">click here</a> to host one!
48-
</div>
49-
<div class="row" *ngIf="filteredChallenges.length">
50-
<div class="col s12 m3" *ngFor="let challenge of filteredChallenges">
51-
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge['id']]">
52-
<app-challengecard [challenge]="challenge"></app-challengecard>
53-
</a>
54-
</div>
55-
</div>
41+
<!-- my challenges -->
42+
<div *ngIf="routerPublic.url === myChallengesRoutePathCommon" [@.disabled]="true">
43+
<mat-tab-group>
44+
<mat-tab label="My Ongoing Challenges ({{ filteredOngoingChallenges.length }})">
45+
<div class="challenge-page-title" id = "ongoing-challenges" ><strong class="text-med-black fs-18">My Hosted Challenges</strong></div>
46+
<div *ngIf="!filteredOngoingChallenges.length">
47+
You haven't hosted any challenge. Please <a [routerLink]="hostTeamsRoutePathCommon" class="highlight-link">click here</a> to host one!
48+
</div>
49+
<div class="row" *ngIf="filteredOngoingChallenges.length">
50+
<div class="col s12 m3" *ngFor="let challenge of filteredOngoingChallenges">
51+
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge['id']]">
52+
<app-challengecard [challenge]="challenge"></app-challengecard>
53+
</a>
54+
</div>
55+
</div>
56+
</mat-tab>
57+
<mat-tab label="My Upcoming Challenges ({{ filteredUpcomingChallenges.length }})">
58+
<div class="challenge-page-title" id = "ongoing-challenges" ><strong class="text-med-black fs-18">My Hosted Challenges</strong></div>
59+
<div *ngIf="!filteredUpcomingChallenges.length">
60+
You haven't hosted any challenge. Please <a [routerLink]="hostTeamsRoutePathCommon" class="highlight-link">click here</a> to host one!
61+
</div>
62+
<div class="row" *ngIf="filteredUpcomingChallenges.length">
63+
<div class="col s12 m3" *ngFor="let challenge of filteredUpcomingChallenges">
64+
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge['id']]">
65+
<app-challengecard [challenge]="challenge"></app-challengecard>
66+
</a>
67+
</div>
68+
</div>
69+
</mat-tab>
70+
<mat-tab label="My Past Challenges ({{ filteredPastChallenges.length }})">
71+
<div class="challenge-page-title" id = "ongoing-challenges" ><strong class="text-med-black fs-18">My Hosted Challenges</strong></div>
72+
<div *ngIf="!filteredPastChallenges.length">
73+
You haven't hosted any challenge. Please <a [routerLink]="hostTeamsRoutePathCommon" class="highlight-link">click here</a> to host one!
74+
</div>
75+
<div class="row" *ngIf="filteredPastChallenges.length">
76+
<div class="col s12 m3" *ngFor="let challenge of filteredPastChallenges">
77+
<a class="ev-card-hover" [routerLink]="[challengeRoutePathCommon,challenge['id']]">
78+
<app-challengecard [challenge]="challenge"></app-challengecard>
79+
</a>
80+
</div>
81+
</div>
82+
</mat-tab>
83+
</mat-tab-group>
5684
</div>
57-
5885
</section>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
a.btn-card-detail:focus {
2+
color: black;
3+
display: block;
4+
height: 40px;
5+
box-sizing: border-box;
6+
border-bottom: 2px solid black;
7+
background-color: white;
8+
}
9+
10+
.none {
11+
margin: 1%;
12+
}

0 commit comments

Comments
 (0)