PUNKT-39 Headery w plikach CSV

This commit is contained in:
Marcin Szczepański 2019-12-13 22:28:58 +01:00
parent b93d25fb5b
commit 4900fc9c6e
2 changed files with 16 additions and 2 deletions

View File

@ -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 {

View File

@ -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) {