From f24b356f04dd0c7810e61bbc810defb02d3e2733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Gerrit=20G=C3=B6bel?= Date: Fri, 23 Jan 2026 09:47:44 +0100 Subject: [PATCH] CSV now exports dates in ISO format --- .../users-dashboard/users-dashboard.component.ts | 10 ++++++---- src/app/data/otac.type.ts | 2 +- src/app/data/scheduledevent.service.ts | 11 +++++++++++ .../otacmanagement/otacmanagement.component.html | 4 +++- .../event/otacmanagement/otacmanagement.component.ts | 4 ++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/app/dashboards/users-dashboard/users-dashboard.component.ts b/src/app/dashboards/users-dashboard/users-dashboard.component.ts index 2458a410..1be6fa11 100644 --- a/src/app/dashboards/users-dashboard/users-dashboard.component.ts +++ b/src/app/dashboards/users-dashboard/users-dashboard.component.ts @@ -14,7 +14,7 @@ interface dashboardUsers extends User { progresses?: Progress[]; uniqueScenarios?: number; otac?: OTAC; - started?: string; + started?: Date; status?: string; } @@ -52,7 +52,7 @@ export class UsersDashboardComponent implements OnInit, OnChanges { `${userData.id || ''},` + // ID column `${userData.email || ''},` + // Email column `${userData.otac?.name || ''},` + // OTAC name column - `${userData.started || ''},` + // Started column + `${userData.started?.toISOString() || ''},` + // Started column `${userData.progresses?.length || 0},` + // Progress count column `${userData.uniqueScenarios || 0},` + // Unique scenarios column `${userData.status || ''}\n`, // Status column and newline @@ -109,7 +109,9 @@ export class UsersDashboardComponent implements OnInit, OnChanges { const safeOtacs = otacs || []; // Default to empty array if null // Map OTACs to users const otacMap = new Map( - safeOtacs.map((otac) => [otac.user, otac]), + safeOtacs + .filter((o): o is OTAC & { user: string } => !!o.user) + .map((o) => [o.user, o]), ); // Group progresses by user ID @@ -212,7 +214,7 @@ export class UsersDashboardComponent implements OnInit, OnChanges { return false; } - const redeemedTimestamp = Date.parse(otac.redeemed_timestamp); + const redeemedTimestamp = otac.redeemed_timestamp.getTime(); const duration = parse(otac.max_duration); if (!duration) { return false; diff --git a/src/app/data/otac.type.ts b/src/app/data/otac.type.ts index e29098fc..1cd20364 100644 --- a/src/app/data/otac.type.ts +++ b/src/app/data/otac.type.ts @@ -1,6 +1,6 @@ export type OTAC = { name: string; user?: string; - redeemed_timestamp?: string; + redeemed_timestamp?: Date; max_duration?: string; }; diff --git a/src/app/data/scheduledevent.service.ts b/src/app/data/scheduledevent.service.ts index 9b6d3d2d..f41f8264 100644 --- a/src/app/data/scheduledevent.service.ts +++ b/src/app/data/scheduledevent.service.ts @@ -14,6 +14,7 @@ import { GargantuaClientFactory, ListableResourceClient, } from './gargantua.service'; +import { OTAC } from './otac.type'; @Injectable({ providedIn: 'root', @@ -151,6 +152,16 @@ export class ScheduledeventService extends ListableResourceClient { + otac.map((iOTAC: OTAC) => { + if (iOTAC.redeemed_timestamp) { + iOTAC.redeemed_timestamp = new Date(iOTAC.redeemed_timestamp); + } else { + iOTAC.redeemed_timestamp = undefined; + } + }); + return otac; + }), ); } diff --git a/src/app/event/otacmanagement/otacmanagement.component.html b/src/app/event/otacmanagement/otacmanagement.component.html index 1c4e96e7..391fc98b 100644 --- a/src/app/event/otacmanagement/otacmanagement.component.html +++ b/src/app/event/otacmanagement/otacmanagement.component.html @@ -85,7 +85,9 @@