Skip to content

Commit

Permalink
Frontend_V2: Increase decimal to 20 and display value received from b…
Browse files Browse the repository at this point in the history
…ackend(#3543)

Co-authored-by: Rishabh Jain <[email protected]>
  • Loading branch information
gautamjajoo and RishabhJain2018 authored Jul 22, 2021
1 parent 625d6b5 commit 5353625
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
phaseSplitSelected(phaseSplit) {
const SELF = this;
SELF.selectedPhaseSplit = phaseSplit;

const API_PATH = SELF.endpointsService.particularChallengePhaseSplitUrl(this.selectedPhaseSplit['id']);
SELF.apiService.getUrl(API_PATH).subscribe(
(data) => {
SELF.leaderboardPrecisionValue = data.leaderboard_decimal_precision;
SELF.setLeaderboardPrecisionValue = `1.${ SELF.leaderboardPrecisionValue }-${ SELF.leaderboardPrecisionValue }`;
},
(err) => {
SELF.globalService.handleApiError(err);
},
() => {}
);

if (SELF.selectedPhaseSplit && SELF.router.url.endsWith('leaderboard/' + phaseSplit['id'])) {
SELF.fetchLeaderboard(SELF.selectedPhaseSplit['id']);
SELF.showLeaderboardByLatest = SELF.selectedPhaseSplit.show_leaderboard_by_latest_submission;
Expand Down Expand Up @@ -620,7 +633,7 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD
SELF.apiService.patchUrl(API_PATH, BODY).subscribe(
(data) => {
this.minusDisabled = SELF.leaderboardPrecisionValue === 0 ? true : false;
this.plusDisabled = SELF.leaderboardPrecisionValue === 5 ? true : false;
this.plusDisabled = SELF.leaderboardPrecisionValue === 20 ? true : false;
},
(err) => {
SELF.globalService.handleApiError(err, true);
Expand Down

0 comments on commit 5353625

Please sign in to comment.