update controller and syncing

This commit is contained in:
Julian Krauser 2025-01-19 13:19:50 +01:00
parent 4dd6fa6d8a
commit b5509ba162
3 changed files with 5 additions and 1 deletions

View file

@ -6,4 +6,5 @@ export interface SynchronizeProtocolPresenceCommand {
export interface ProtocolPresenceCommand { export interface ProtocolPresenceCommand {
memberId: number; memberId: number;
absent: boolean; absent: boolean;
excused: boolean;
} }

View file

@ -74,6 +74,7 @@ export default abstract class ProtocolPresenceCommandHandler {
.update(protocolPresence) .update(protocolPresence)
.set({ .set({
absent: member.absent, absent: member.absent,
excused: member.excused,
}) })
.where("memberId = :memberId", { memberId: member.memberId }) .where("memberId = :memberId", { memberId: member.memberId })
.andWhere("protocolId = :protocolId", { protocolId }) .andWhere("protocolId = :protocolId", { protocolId })

View file

@ -260,7 +260,8 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
agenda, agenda,
decisions, decisions,
presence: presence.filter((p) => !p.absent).map((p) => p.member), 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, votings,
}, },
}); });
@ -389,6 +390,7 @@ export async function synchronizeProtocolPrecenseById(req: Request, res: Respons
members: presence.map((p) => ({ members: presence.map((p) => ({
memberId: p.memberId, memberId: p.memberId,
absent: p.absent, absent: p.absent,
excused: p.excused,
})), })),
protocolId, protocolId,
}; };