From 7116eb1c21fe479e0186bd2d2d0f96f1132c5b44 Mon Sep 17 00:00:00 2001 From: Gautam Jajoo Date: Thu, 5 Aug 2021 19:44:50 +0530 Subject: [PATCH] Frontend_V2: Remove submission count api call from submissions page(#3562) * remove submission count api call * remove space Co-authored-by: Rishabh Jain --- .../challengesubmissions.component.ts | 27 ++----------------- .../challengeviewallsubmissions.component.ts | 25 +---------------- 2 files changed, 3 insertions(+), 49 deletions(-) diff --git a/frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts b/frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts index 0feb9e7678..f1c00fd0f2 100644 --- a/frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts +++ b/frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts @@ -249,7 +249,6 @@ export class ChallengesubmissionsComponent implements OnInit, AfterViewInit { SELF.submissionCount = 0; if (SELF.challenge['id'] && phase['id']) { SELF.fetchSubmissions(SELF.challenge['id'], phase['id']); - SELF.fetchSubmissionCounts(this.challenge['id'], phase['id']); } }; } @@ -265,6 +264,7 @@ export class ChallengesubmissionsComponent implements OnInit, AfterViewInit { API_PATH = SELF.endpointsService.challengeSubmissionURL(challenge, phase); SELF.apiService.getUrl(API_PATH).subscribe( (data) => { + SELF.submissionCount = data['count']; SELF.submissions = data['results']; let index = 0; SELF.submissions.forEach((submission) => { @@ -488,30 +488,7 @@ export class ChallengesubmissionsComponent implements OnInit, AfterViewInit { ); } } - - /** - * Fetch number of submissions for a challenge phase. - * @param challenge challenge id - * @param phase phase id - */ - fetchSubmissionCounts(challenge, phase) { - const API_PATH = this.endpointsService.challengeSubmissionCountURL(challenge, phase); - const SELF = this; - this.apiService.getUrl(API_PATH).subscribe( - (data) => { - if (data['participant_team_submission_count']) { - SELF.submissionCount = data['participant_team_submission_count']; - } - }, - (err) => { - SELF.globalService.handleApiError(err); - }, - () => { - this.logger.info('Fetched submission counts', challenge, phase); - } - ); - } - + /** * Display Edit Submission Modal. * @param submission Submission being edited diff --git a/frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts b/frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts index eb399d26fc..d1c42d3e76 100644 --- a/frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts +++ b/frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts @@ -247,7 +247,6 @@ export class ChallengeviewallsubmissionsComponent implements OnInit, AfterViewIn SELF.submissionCount = 0; if (SELF.challenge['id'] && phase['id']) { SELF.fetchSubmissions(SELF.challenge['id'], phase['id']); - SELF.fetchSubmissionCounts(this.challenge['id'], phase['id']); } }; } @@ -276,6 +275,7 @@ export class ChallengeviewallsubmissionsComponent implements OnInit, AfterViewIn SELF.apiService.getUrl(API_PATH).subscribe( (data) => { if(name == SELF.filterSubmissionsQuery) { + SELF.submissionCount = data['count']; SELF.submissions = data['results']; let index = 0; SELF.submissions.forEach((submission) => { @@ -534,29 +534,6 @@ export class ChallengeviewallsubmissionsComponent implements OnInit, AfterViewIn SELF.globalService.showConfirm(PARAMS); } - /** - * Fetch number of submissions for a challenge phase. - * @param challenge challenge id - * @param phase phase id - */ - fetchSubmissionCounts(challenge, phase) { - const API_PATH = this.endpointsService.challengeSubmissionCountURL(challenge, phase); - const SELF = this; - this.apiService.getUrl(API_PATH).subscribe( - (data) => { - if (data['participant_team_submission_count']) { - SELF.submissionCount = data['participant_team_submission_count']; - } - }, - (err) => { - SELF.globalService.handleApiError(err); - }, - () => { - this.logger.info('Fetched submission counts', challenge, phase); - } - ); - } - /** * Modal to confirm the change of submission visibility * @param submission Selected submission