Merge pull request 'feature/#40-protocol-presence-status' (#44) from feature/#40-protocol-presence-status into develop

Reviewed-on: #44
This commit is contained in:
Julian Krauser 2025-01-19 12:46:46 +00:00
commit 2d8e8a2e42
9 changed files with 46 additions and 3 deletions

View file

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

View file

@ -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 })

View file

@ -260,7 +260,9 @@ 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),
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,
},
});
@ -389,6 +391,7 @@ export async function synchronizeProtocolPrecenseById(req: Request, res: Respons
members: presence.map((p) => ({
memberId: p.memberId,
absent: p.absent,
excused: p.excused,
})),
protocolId,
};

View file

@ -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",

View file

@ -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",

View file

@ -12,6 +12,7 @@ export default abstract class ProtocolPresenceFactory {
return {
memberId: record.member.id,
absent: record.absent,
excused: record.excused,
protocolId: record.protocolId,
};
}

View file

@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
export class ProtocolPresenceExcuse1737287798828 implements MigrationInterface {
name = "ProtocolPresenceExcuse1737287798828";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumn(
"protocol_presence",
new TableColumn({
name: "excused",
type: "tinyint",
default: "1",
isNullable: false,
})
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumn("protocol_presence", "excused");
}
}

View file

@ -14,9 +14,19 @@
<br />
<br />
<h2>Anwesenheit ({{presence.length}})</h2>
<p>{{#each presence}} {{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}} {{/each}}</p>
<p>
{{#each presence}}{{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}}{{/each}}{{#unless
presence.length}}---{{/unless}}
</p>
<h2>Abwesenheit ({{absent.length}})</h2>
<p>{{#each absent}} {{this.firstname}} {{this.lastname}}{{#unless @last}}, {{/unless}} {{/each}}</p>
<p>
entschuldigt: {{#each excused_absent}}{{this.firstname}} {{this.lastname}}{{#unless @last}},
{{/unless}}{{/each}}{{#unless excused_absent.length}}---{{/unless}}
</p>
<p>
unentschuldigt: {{#each unexcused_absent}}{{this.firstname}} {{this.lastname}}{{#unless @last}},
{{/unless}}{{/each}}{{#unless unexcused_absent.length}}---{{/unless}}
</p>
<br />
<h2>Agenda</h2>
{{#each agenda}}

View file

@ -3,5 +3,6 @@ import { MemberViewModel } from "../member/member.models";
export interface ProtocolPresenceViewModel {
memberId: number;
absent: boolean;
excused: boolean;
protocolId: number;
}