add sorting to protocol agenda, decision and votings

This commit is contained in:
Julian Krauser 2025-03-21 09:46:29 +01:00
parent 4b6f0b34df
commit 2e5b345daa
22 changed files with 138 additions and 16 deletions

View file

@ -257,13 +257,13 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
}),
start: protocol.starttime,
end: protocol.endtime,
agenda,
decisions,
agenda: agenda.sort((a, b) => a.sort - b.sort),
decisions: decisions.sort((a, b) => a.sort - b.sort),
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,
votings: votings.sort((a, b) => a.sort - b.sort),
},
});
@ -320,6 +320,7 @@ export async function synchronizeProtocolAgendaById(req: Request, res: Response)
id: a.id ?? null,
topic: a.topic,
context: a.context,
sort: a.sort,
protocolId,
})
);
@ -343,6 +344,7 @@ export async function synchronizeProtocolDecisonsById(req: Request, res: Respons
id: d.id ?? null,
topic: d.topic,
context: d.context,
sort: d.sort,
protocolId,
})
);
@ -362,13 +364,14 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response
let votings = req.body.votings as Array<ProtocolVotingViewModel>;
let syncVoting: Array<SynchronizeProtocolVotingCommand> = votings.map(
(d: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
id: d.id ?? null,
topic: d.topic,
context: d.context,
favour: d.favour,
abstain: d.abstain,
against: d.abstain,
(v: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
id: v.id ?? null,
topic: v.topic,
context: v.context,
favour: v.favour,
abstain: v.abstain,
against: v.abstain,
sort: v.sort,
protocolId,
})
);