protocol absence

This commit is contained in:
Julian Krauser 2025-01-05 12:12:53 +01:00
parent 455589e2b5
commit 161a9dc51c
10 changed files with 86 additions and 23 deletions

View file

@ -28,6 +28,7 @@ import ProtocolPrintoutFactory from "../../factory/admin/protocolPrintout";
import { CreateProtocolPrintoutCommand } from "../../command/protocolPrintoutCommand";
import ProtocolPrintoutCommandHandler from "../../command/protocolPrintoutCommandHandler";
import { FileSystemHelper } from "../../helpers/fileSystemHelper";
import { ProtocolPresenceViewModel } from "../../viewmodel/admin/protocolPresence.models";
/**
* @description get all protocols
@ -228,7 +229,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
let votings = await ProtocolVotingService.getAll(protocolId);
let iteration = await ProtocolPrintoutService.getCount(protocolId);
let title = `Sitzungsprotokoll - ${new Date(protocol.date).toLocaleDateString("de-DE", {
let title = `${protocol.title} - ${new Date(protocol.date).toLocaleDateString("de-DE", {
day: "2-digit",
month: "long",
year: "numeric",
@ -258,7 +259,8 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
end: protocol.endtime,
agenda,
decisions,
presence: presence.map((p) => p.member),
presence: presence.filter((p) => !p.absent).map((p) => p.member),
absent: presence.filter((p) => p.absent).map((p) => p.member),
votings,
},
});
@ -381,10 +383,13 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response
*/
export async function synchronizeProtocolPrecenseById(req: Request, res: Response): Promise<any> {
let protocolId = parseInt(req.params.protocolId);
let presence = req.body.presence as Array<number>;
let presence = req.body.presence as Array<ProtocolPresenceViewModel>;
let syncPresence: SynchronizeProtocolPresenceCommand = {
memberIds: presence,
members: presence.map((p) => ({
memberId: p.memberId,
absent: p.absent,
})),
protocolId,
};
await ProtocolPresenceCommandHandler.sync(syncPresence);