From e491336028d79512ca76509c74dd28fedcb4066d Mon Sep 17 00:00:00 2001 From: Aaron Diaz <73670693+aaron-diaz@users.noreply.github.com> Date: Sat, 19 Oct 2024 12:14:23 -0600 Subject: [PATCH] [Feature] Fecha de registro de cada participante al exportar a spreadsheet (#92) * Added registration date in contestants spreadsheet * Update ofmi.ts * Update ofmi.ts --------- Co-authored-by: Juan Carlos Sigler Priego --- src/lib/gcloud.ts | 1 + src/lib/ofmi.ts | 2 ++ src/types/participation.schema.ts | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/gcloud.ts b/src/lib/gcloud.ts index 290545b..6d47c92 100644 --- a/src/lib/gcloud.ts +++ b/src/lib/gcloud.ts @@ -273,6 +273,7 @@ export async function exportParticipants({ if (userParticipation.role === "CONTESTANT") { data = { ...data, + "Fecha de registro": `=DATEVALUE(MID("${participation.registeredAt}",1,10))+TIMEVALUE(MID("${participation.registeredAt}",12,8))`, Estado: userParticipation.schoolState, Escuela: userParticipation.schoolName.trim(), }; diff --git a/src/lib/ofmi.ts b/src/lib/ofmi.ts index 026d7fd..350bc9a 100644 --- a/src/lib/ofmi.ts +++ b/src/lib/ofmi.ts @@ -118,6 +118,7 @@ export async function findParticipants( references: mailingAddress.references ?? undefined, }, }, + registeredAt: participation.createdAt, userParticipation: userParticipation as UserParticipation, }; @@ -201,6 +202,7 @@ export async function findParticipation( references: mailingAddress.references ?? undefined, }, }, + registeredAt: participation.createdAt, userParticipation: userParticipation as UserParticipation, }; diff --git a/src/types/participation.schema.ts b/src/types/participation.schema.ts index 7e25f71..464cc1e 100644 --- a/src/types/participation.schema.ts +++ b/src/types/participation.schema.ts @@ -109,13 +109,17 @@ export type ParticipationRequestInput = Static< export const ParticipationRequestInputSchema = Type.Object({ ofmiEdition: Type.Integer({ minimum: 1 }), user: UserInputSchema, + registeredAt: Type.Date(), userParticipation: UserParticipationSchema, }); export type UpsertParticipationRequest = Static< typeof UpsertParticipationRequestSchema >; -export const UpsertParticipationRequestSchema = ParticipationRequestInputSchema; +export const UpsertParticipationRequestSchema = Type.Omit( + ParticipationRequestInputSchema, + ["registeredAt"], +); export interface UpsertParticipationResponse { participation: Participation;