From a4b26013a71cbfa588701199de736a1adfd50a18 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sat, 18 Jan 2025 14:58:32 +0100 Subject: [PATCH 1/4] weburl change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4896a21..3dcc570 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Administration für Feuerwehren und Vereine (Backend). Dieses Projekt, `ff-admin-server`, ist das Backend zur Verwaltung von Mitgliederdaten. Die zugehörige Webapp ist im Repository [ff-admin-ui](https://forgejo.jk-effects.cloud/Ehrenamt/ff-admin) zu finden. -Eine Demo zusammen mit der `ff-admin` finden Sie unter [ff-admin-demo.jk-effects.cloud](ff-admin-demo.jk-effects.cloud). +Eine Demo zusammen mit der `ff-admin` finden Sie unter [https://admin-demo.ff-admin.de](https://admin-demo.ff-admin.de). ## Installation From 4dd6fa6d8a73eb4d660416fba7a46358590c3ca2 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sun, 19 Jan 2025 13:14:12 +0100 Subject: [PATCH 2/4] add excused state to protocol presence --- src/data-source.ts | 2 ++ src/entity/club/protocol/protocolPresence.ts | 3 +++ .../admin/club/protocol/protocolPresence.ts | 1 + .../1737287798828-protocolPresenceExcuse.ts | 21 +++++++++++++++++++ .../club/protocol/protocolPresence.models.ts | 1 + 5 files changed, 28 insertions(+) create mode 100644 src/migrations/1737287798828-protocolPresenceExcuse.ts diff --git a/src/data-source.ts b/src/data-source.ts index 4c4a424..c7ba457 100644 --- a/src/data-source.ts +++ b/src/data-source.ts @@ -67,6 +67,7 @@ import { ProtocolAbsent1736072179716 } from "./migrations/1736072179716-protocol import { Memberlist1736079005086 } from "./migrations/1736079005086-memberlist"; import { ExtendViewValues1736084198860 } from "./migrations/1736084198860-extendViewValues"; import { FinishInternalIdTransfer1736505324488 } from "./migrations/1736505324488-finishInternalIdTransfer"; +import { ProtocolPresenceExcuse1737287798828 } from "./migrations/1737287798828-protocolPresenceExcuse"; const dataSource = new DataSource({ type: DB_TYPE as any, @@ -144,6 +145,7 @@ const dataSource = new DataSource({ Memberlist1736079005086, ExtendViewValues1736084198860, FinishInternalIdTransfer1736505324488, + ProtocolPresenceExcuse1737287798828, ], migrationsRun: true, migrationsTransactionMode: "each", diff --git a/src/entity/club/protocol/protocolPresence.ts b/src/entity/club/protocol/protocolPresence.ts index ef7f0cb..15fe061 100644 --- a/src/entity/club/protocol/protocolPresence.ts +++ b/src/entity/club/protocol/protocolPresence.ts @@ -13,6 +13,9 @@ export class protocolPresence { @Column({ type: "boolean", default: false }) absent: boolean; + @Column({ type: "boolean", default: true }) + excused: boolean; + @ManyToOne(() => member, { nullable: false, onDelete: "CASCADE", diff --git a/src/factory/admin/club/protocol/protocolPresence.ts b/src/factory/admin/club/protocol/protocolPresence.ts index 37ca37a..5cfbeb4 100644 --- a/src/factory/admin/club/protocol/protocolPresence.ts +++ b/src/factory/admin/club/protocol/protocolPresence.ts @@ -12,6 +12,7 @@ export default abstract class ProtocolPresenceFactory { return { memberId: record.member.id, absent: record.absent, + excused: record.excused, protocolId: record.protocolId, }; } diff --git a/src/migrations/1737287798828-protocolPresenceExcuse.ts b/src/migrations/1737287798828-protocolPresenceExcuse.ts new file mode 100644 index 0000000..c3954e1 --- /dev/null +++ b/src/migrations/1737287798828-protocolPresenceExcuse.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner, TableColumn } from "typeorm"; + +export class ProtocolPresenceExcuse1737287798828 implements MigrationInterface { + name = "ProtocolPresenceExcuse1737287798828"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.addColumn( + "protocol_presence", + new TableColumn({ + name: "excused", + type: "tinyint", + default: "1", + isNullable: false, + }) + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropColumn("protocol_presence", "excused"); + } +} diff --git a/src/viewmodel/admin/club/protocol/protocolPresence.models.ts b/src/viewmodel/admin/club/protocol/protocolPresence.models.ts index 476dc99..9bc363c 100644 --- a/src/viewmodel/admin/club/protocol/protocolPresence.models.ts +++ b/src/viewmodel/admin/club/protocol/protocolPresence.models.ts @@ -3,5 +3,6 @@ import { MemberViewModel } from "../member/member.models"; export interface ProtocolPresenceViewModel { memberId: number; absent: boolean; + excused: boolean; protocolId: number; } From b5509ba1624a86501a95731ced37463fd7376ffa Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sun, 19 Jan 2025 13:19:50 +0100 Subject: [PATCH 3/4] 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 4/4] 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}}