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

Show error message when downloading submissions that has > 5k results #3442

Merged
merged 6 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
@@ -1,11 +1,26 @@
<div class="challenge-card">

<!-- Card for submissions greater than 5000 -->
<div class="ev-card-panel card-bt-margin" *ngIf="submissionCount > 5000">
<div class="ev-md-container">
<div class="col-md-11 col-sm-11 col-xs-10 col-lr-pad">
<div class="fw-light">
<p class="fs-16">
<strong> Note: </strong> Results are greater than 5k, please use the
<a href="https://eval.ai/api/docs/#operation/get_all_submissions_for_a_challenge"><strong class="blue-text"> get_all_submissions </strong></a> API to download results.
</p>
</div>
</div>
</div>
</div>

<div class="ev-card-panel card-bt-margin">
<div class="ev-md-container bottom-hr-line">
<div class="row row-lr-margin phase-title">
<div class="col-sm-12">
<h5 class="fw-light">All Submissions</h5>
</div>
</div>
</div>
<div class="row row-lr-margin">
<div class="col-sm-6 col-xs-12 col-lg-6 col-lr-pad phase-select-box">
<app-selectphase
Expand All @@ -28,7 +43,10 @@ <h5 class="fw-light">All Submissions</h5>
</mat-form-field>
</div>
<div class="col-md-2 col-sm-2 col-xs-6 col-lg-6 col-lr-pad download-submissions">
<a class="waves-effect waves-dark btn ev-btn-dark w-300 fs-16" (click)="downloadSubmission()">Download </a>
<button
class="btn ev-btn-dark btn-waves-effect waves-dark grad-btn grad-btn-dark fs-14"
(click)="downloadSubmission()"
[disabled]="submissionCount>5000">Download </button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,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 All @@ -263,6 +262,7 @@ export class ChallengeviewallsubmissionsComponent implements OnInit, AfterViewIn
SELF.apiService.getUrl(API_PATH).subscribe(
(data) => {
SELF.submissions = data['results'];
SELF.submissionCount = data.count;
let index = 0;
SELF.submissions.forEach((submission) => {
submission['s_no'] = index + 1;
Expand Down Expand Up @@ -504,29 +504,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
2 changes: 1 addition & 1 deletion frontend_v2/src/app/services/endpoints.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ ${phase}/submission?participant_team__team_name=${participantTeamName}`;
}

/**
* Challenge Submission Counts
* Challenge Submission Counts of the participant Team
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please revert this change as it's required for this PR

Copy link
Member Author

@gautamjajoo gautamjajoo Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were using this url on the submissions page, but this was confusing whether it was for all submissions or submissions for a particular team that's why I have modified it to make it more descriptive.

* @param challenge challenge id
* @param phase phase id
*/
Expand Down