Skip to content

Commit

Permalink
Refactor and fix tests #716
Browse files Browse the repository at this point in the history
  • Loading branch information
caebr committed Dec 12, 2024
1 parent a40bdc1 commit d36ddc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/app/events/services/events-students-state.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,27 +404,31 @@ describe("EventsStudentsStateService", () => {
lastName: "McCartney",
email: "paul.mccartney@example.com",
status: "Angemeldet",
subscriptionId: 12,
},
{
id: 20,
firstName: "John",
lastName: "Lennon",
email: "john.lennon@example.com",
status: "Aufgenommen",
subscriptionId: 22,
},
{
id: 30,
firstName: "George",
lastName: "Harrison",
email: "george.harrison@example.com",
status: "Aufgenommen",
subscriptionId: 32,
},
{
id: 40,
firstName: "Ringo",
lastName: "Starr",
email: "ringo.starr@example.com",
status: "Aufgenommen",
subscriptionId: 42,
},
];

Expand Down Expand Up @@ -487,27 +491,31 @@ describe("EventsStudentsStateService", () => {
lastName: "McCartney",
email: "paul.mccartney@example.com",
status: "Angemeldet",
subscriptionId: 13,
},
{
id: 20,
firstName: "John",
lastName: "Lennon",
email: "john.lennon@example.com",
status: "Aufgenommen",
subscriptionId: 23,
},
{
id: 30,
firstName: "George",
lastName: "Harrison",
email: "george.harrison@example.com",
status: "Aufgenommen",
subscriptionId: 33,
},
{
id: 40,
firstName: "Ringo",
lastName: "Starr",
email: "ringo.starr@example.com",
status: "Aufgenommen",
subscriptionId: 43,
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/app/events/services/events-students-state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export type StudentEntries = {

export type StudentEntry = {
id: number;
subscriptionId?: number;
firstName: string;
lastName: string;
email?: string;
status?: string;
studyClass?: string;
company?: string;
subscriptionId?: number;
};

export type PrimarySortKey = "name";
Expand Down
4 changes: 2 additions & 2 deletions src/app/events/utils/events-students.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export function convertPersonsToStudentEntries(
(person) =>
({
id: person.Id,
subscriptionId: subscriptions.find((s) => s.PersonId === person.Id)
?.Id,
firstName: person.FirstName,
lastName: person.LastName,
email: person.DisplayEmail ?? undefined,
status: subscriptions.find((s) => s.PersonId === person.Id)?.Status,
subscriptionId: subscriptions.find((s) => s.PersonId === person.Id)
?.Id,
}) satisfies StudentEntry,
),
};
Expand Down

0 comments on commit d36ddc7

Please sign in to comment.