From b5509ba1624a86501a95731ced37463fd7376ffa Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sun, 19 Jan 2025 13:19:50 +0100 Subject: [PATCH 1/2] update controller and syncing --- src/command/club/protocol/protocolPresenceCommand.ts | 1 + src/command/club/protocol/protocolPresenceCommandHandler.ts | 1 + src/controller/admin/club/protocolController.ts | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/command/club/protocol/protocolPresenceCommand.ts b/src/command/club/protocol/protocolPresenceCommand.ts index 76c004a..134aeac 100644 --- a/src/command/club/protocol/protocolPresenceCommand.ts +++ b/src/command/club/protocol/protocolPresenceCommand.ts @@ -6,4 +6,5 @@ export interface SynchronizeProtocolPresenceCommand { export interface ProtocolPresenceCommand { memberId: number; absent: boolean; + excused: boolean; } diff --git a/src/command/club/protocol/protocolPresenceCommandHandler.ts b/src/command/club/protocol/protocolPresenceCommandHandler.ts index abdb82b..8d48fe6 100644 --- a/src/command/club/protocol/protocolPresenceCommandHandler.ts +++ b/src/command/club/protocol/protocolPresenceCommandHandler.ts @@ -74,6 +74,7 @@ export default abstract class ProtocolPresenceCommandHandler { .update(protocolPresence) .set({ absent: member.absent, + excused: member.excused, }) .where("memberId = :memberId", { memberId: member.memberId }) .andWhere("protocolId = :protocolId", { protocolId }) diff --git a/src/controller/admin/club/protocolController.ts b/src/controller/admin/club/protocolController.ts index bba8aa0..0a30b81 100644 --- a/src/controller/admin/club/protocolController.ts +++ b/src/controller/admin/club/protocolController.ts @@ -260,7 +260,8 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P agenda, decisions, presence: presence.filter((p) => !p.absent).map((p) => p.member), - absent: presence.filter((p) => p.absent).map((p) => p.member), + excused_absent: presence.filter((p) => p.absent && p.excused).map((p) => p.member), + unexcused_absent: presence.filter((p) => p.absent && !p.excused).map((p) => p.member), votings, }, }); @@ -389,6 +390,7 @@ export async function synchronizeProtocolPrecenseById(req: Request, res: Respons members: presence.map((p) => ({ memberId: p.memberId, absent: p.absent, + excused: p.excused, })), protocolId, }; From eb8f3fef3e713b3833e7b0030e29cd273b020931 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sun, 19 Jan 2025 13:42:18 +0100 Subject: [PATCH 2/2] update template --- src/controller/admin/club/protocolController.ts | 1 + src/templates/protocol.body.template.html | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/controller/admin/club/protocolController.ts b/src/controller/admin/club/protocolController.ts index 0a30b81..868715f 100644 --- a/src/controller/admin/club/protocolController.ts +++ b/src/controller/admin/club/protocolController.ts @@ -260,6 +260,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P agenda, decisions, presence: presence.filter((p) => !p.absent).map((p) => p.member), + absent: presence.filter((p) => p.absent).map((p) => ({ ...p.member, excused: p.excused })), excused_absent: presence.filter((p) => p.absent && p.excused).map((p) => p.member), unexcused_absent: presence.filter((p) => p.absent && !p.excused).map((p) => p.member), votings, diff --git a/src/templates/protocol.body.template.html b/src/templates/protocol.body.template.html index c37fa75..5a263ff 100644 --- a/src/templates/protocol.body.template.html +++ b/src/templates/protocol.body.template.html @@ -14,9 +14,19 @@

Anwesenheit ({{presence.length}})

-

{{#each presence}} {{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}} {{/each}}

+

+ {{#each presence}}{{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}}{{/each}}{{#unless + presence.length}}---{{/unless}} +

Abwesenheit ({{absent.length}})

-

{{#each absent}} {{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}} {{/each}}

+

+ entschuldigt: {{#each excused_absent}}{{this.firstname}} {{this.lastname}}{{#unless @last}}, + {{/unless}}{{/each}}{{#unless excused_absent.length}}---{{/unless}} +

+

+ unentschuldigt: {{#each unexcused_absent}}{{this.firstname}} {{this.lastname}}{{#unless @last}}, + {{/unless}}{{/each}}{{#unless unexcused_absent.length}}---{{/unless}} +


Agenda

{{#each agenda}}