From 4900fc9c6e0ef7e11e867e3b28b2416fedfc89ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Szczepa=C5=84ski?= Date: Fri, 13 Dec 2019 22:28:58 +0100 Subject: [PATCH] PUNKT-39 Headery w plikach CSV --- FrontEnd/src/app/groups/ranking/ranking.component.ts | 9 ++++++++- .../tests-in-group-results.component.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/FrontEnd/src/app/groups/ranking/ranking.component.ts b/FrontEnd/src/app/groups/ranking/ranking.component.ts index e371f60..7a7c65b 100644 --- a/FrontEnd/src/app/groups/ranking/ranking.component.ts +++ b/FrontEnd/src/app/groups/ranking/ranking.component.ts @@ -62,10 +62,17 @@ export class RankingComponent implements OnInit, OnDestroy { } downloadCSVResults() { + const options = { + fieldSeparator: ';', + quoteStrings: '', + decimalseparator: ',', + showLabels: true, + headers: ['Punkty', 'Imię', 'Nazwisko'] + }; const arr = this.data; arr.map(x => delete x['username']); // tslint:disable-next-line:no-unused-expression - new ngxCsv(arr, this.group.name + '_ranking_' + this.typeOfRankingToDisplay); + new ngxCsv(arr, this.group.name + '_ranking_' + this.typeOfRankingToDisplay, options); } ngOnDestroy(): void { diff --git a/FrontEnd/src/app/groups/tests-in-group-results/tests-in-group-results.component.ts b/FrontEnd/src/app/groups/tests-in-group-results/tests-in-group-results.component.ts index 4fd37a1..320fd81 100644 --- a/FrontEnd/src/app/groups/tests-in-group-results/tests-in-group-results.component.ts +++ b/FrontEnd/src/app/groups/tests-in-group-results/tests-in-group-results.component.ts @@ -103,8 +103,15 @@ export class TestsInGroupResultsComponent implements OnInit, OnDestroy { } downloadCSVResults() { + const options = { + fieldSeparator: ';', + quoteStrings: '', + decimalseparator: ',', + showLabels: true, + headers: ['Imię', 'Nazwisko', 'Wynik', 'Wynik (%)'] + }; // tslint:disable-next-line:no-unused-expression - new ngxCsv(this.testdata, this.group.name + '_' + this.selectedTest.title + '_wyniki'); + new ngxCsv(this.testdata, this.group.name + '_' + this.selectedTest.title + '_wyniki', options); } getResults(id: number) {