Wyświetlanie daty i godziny rozpoczęcia testu

This commit is contained in:
s416122 2020-01-13 14:44:14 +01:00
parent 1c6e435121
commit cd33d8d7a9
1 changed files with 18 additions and 4 deletions

View File

@ -39,7 +39,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: false },
{ headerName: 'Rozpoczęcie testu', field: 'dateFrom', headerTooltip: 'Rozpoczęcie testu' },
{ headerName: 'Rozpoczęcie testu', field: 'startDate', headerTooltip: 'Rozpoczęcie testu' },
{
headerName: '',
suppressMenu: true,
@ -207,7 +207,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: true },
{ headerName: 'Rozpoczęcie testu', field: 'dateFrom', headerTooltip: 'Rozpoczęcie testu'},
{ headerName: 'Rozpoczęcie testu', field: 'startDate', headerTooltip: 'Rozpoczęcie testu'},
{
headerName: '',
suppressMenu: true,
@ -220,7 +220,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.' },
{ headerName: 'Rozpoczęcie testu', field: 'dateFrom', headerTooltip: 'Rozpoczęcie testu'},
{ headerName: 'Rozpoczęcie testu', field: 'startDate', headerTooltip: 'Rozpoczęcie testu'},
{
headerName: '',
suppressMenu: true,
@ -279,7 +279,21 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
if (resource === 'testów') {
this.localeText.noRowsToShow = 'Brak testów do wyświetlenia';
setTimeout(() => {
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => this.data = data);
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => {
this.data = data;
data.forEach(x => {
const temp = new Date(x['dateFrom']);
x['startDate'] = '';
const hours = temp.getHours();
const minutes = temp.getMinutes();
const months = ['STY', 'LUT', 'MAR', 'KWI', 'MAJ', 'CZE', 'LIP', 'SIE', 'WRZ', 'PAŹ', 'LIS', 'GRU'];
const year = temp.getFullYear();
const month = months[temp.getMonth()];
const date = temp.getDate();
const time = date + ' ' + month + ' ' + year + ' ' + hours + ':' + minutes;
x['startDate'] += time;
});
});
this.dataToDisplay = resource;
}, 200);