Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove submission count api call from submissions page #3562

Merged
merged 3 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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