Skip to content

Commit

Permalink
Frontend_V2: Remove submission count api call from submissions page(#…
Browse files Browse the repository at this point in the history
…3562)

* remove submission count api call

* remove space

Co-authored-by: Rishabh Jain <[email protected]>
  • Loading branch information
gautamjajoo and RishabhJain2018 authored Aug 5, 2021
1 parent 8b2fad8 commit 7116eb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
};
}
Expand All @@ -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) => {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
};
}
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7116eb1

Please sign in to comment.