Skip to content

Commit

Permalink
add card for results> 5k
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamjajoo committed Jun 2, 2021
1 parent b8a6047 commit 0bd500e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
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 @@ -262,7 +262,7 @@ export class ChallengeviewallsubmissionsComponent implements OnInit, AfterViewIn
SELF.apiService.getUrl(API_PATH).subscribe(
(data) => {
SELF.submissions = data['results'];
this.submissionCount = data.count;
SELF.submissionCount = data.count;
let index = 0;
SELF.submissions.forEach((submission) => {
submission['s_no'] = index + 1;
Expand Down Expand Up @@ -335,22 +335,17 @@ export class ChallengeviewallsubmissionsComponent implements OnInit, AfterViewIn
);
const SELF = this;
if (SELF.fieldsToGetExport.length === 0 || SELF.fieldsToGetExport === undefined) {
if(this.submissionCount > 5000) {
this.globalService.showToast('error', 'Results are greater than 5k you should use the ' + ('get_all_submissions ').link('https://eval.ai/api/docs/#operation/get_all_submissions_for_a_challenge') + 'API to download results', 10);
}
else {
SELF.apiService.getUrl(API_PATH, false).subscribe(
(data) => {
SELF.windowService.downloadFile(data, 'all_submissions.csv');
},
(err) => {
SELF.globalService.handleApiError(err);
},
() => {
this.logger.info('Download complete.', SELF.challenge['id'], SELF.selectedPhase['id']);
}
);
}
SELF.apiService.getUrl(API_PATH, false).subscribe(
(data) => {
SELF.windowService.downloadFile(data, 'all_submissions.csv');
},
(err) => {
SELF.globalService.handleApiError(err);
},
() => {
this.logger.info('Download complete.', SELF.challenge['id'], SELF.selectedPhase['id']);
}
);
}
} else {
if (this.selectedPhase === null) {
Expand Down

0 comments on commit 0bd500e

Please sign in to comment.