Skip to content

Commit

Permalink
Merge branch 'main' into bug/712-713-student-list-under-current-events
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf authored Dec 17, 2024
2 parents 5286075 + ea3225b commit 04df09a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
}
],
"optimization": true,
"outputHashing": "all",
"outputHashing": "none",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
Expand Down
12 changes: 4 additions & 8 deletions src/app/events/services/events-students-state.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,19 @@ describe("EventsStudentsStateService", () => {
};

const paul = buildStudent(10);
paul.FirstName = "Paul";
paul.LastName = "McCartney";
paul.FullName = "McCartney Paul";
paul.DisplayEmail = "paul.mccartney@example.com";

const john = buildStudent(20);
john.FirstName = "John";
john.LastName = "Lennon";
john.FullName = "Lennon John";
john.DisplayEmail = "john.lennon@example.com";

const george = buildStudent(30);
george.FirstName = "George";
george.LastName = "Harrison";
george.FullName = "Harrison George";
george.DisplayEmail = "george.harrison@example.com";

const ringo = buildStudent(40);
ringo.FirstName = "Ringo";
ringo.LastName = "Starr";
ringo.FullName = "Starr Ringo";
ringo.DisplayEmail = "ringo.starr@example.com";

students = [paul, john, george, ringo];
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 @@ -24,7 +24,7 @@ export function convertCourseToStudentEntries(course: Course): StudentEntries {
(student) =>
({
id: student.Id,
name: `${student.LastName} ${student.FirstName}`,
name: student.FullName,
email: student.DisplayEmail ?? undefined,
}) satisfies StudentEntry,
) ?? [];
Expand Down Expand Up @@ -70,7 +70,7 @@ export function convertPersonsToStudentEntries(
(person) =>
({
id: person.Id,
name: `${person.LastName} ${person.FirstName}`,
name: person.FullName,
email: person.DisplayEmail ?? undefined,
status: subscriptions.find((s) => s.PersonId === person.Id)?.Status,
}) satisfies StudentEntry,
Expand Down
3 changes: 1 addition & 2 deletions src/app/shared/models/person.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const Person = t.type({
const PersonSummary = t.type({
Id: t.number,
DisplayEmail: Option(t.string),
FirstName: t.string,
LastName: t.string,
FullName: t.string,
});

type Person = t.TypeOf<typeof Person>;
Expand Down
7 changes: 3 additions & 4 deletions src/app/shared/services/persons-rest.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ describe("PersonsRestService", () => {
const personSummaries: ReadonlyArray<PersonSummary> = [
buildPersonSummary(54425),
buildPersonSummary(56200),
].map(({ Id, FirstName, LastName, DisplayEmail }) => ({
].map(({ Id, FullName, DisplayEmail }) => ({
Id,
FirstName,
LastName,
FullName,
DisplayEmail,
}));

Expand All @@ -52,7 +51,7 @@ describe("PersonsRestService", () => {

httpTestingController
.expectOne(
"https://eventotest.api/Persons/?filter.Id=;54425;56200&fields=Id,FirstName,LastName,DisplayEmail",
"https://eventotest.api/Persons/?filter.Id=;54425;56200&fields=Id,FullName,DisplayEmail",
)
.flush(personSummaries);
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/persons-rest.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class PersonsRestService extends RestService<typeof Person> {
.get<unknown>(`${this.baseUrl}/`, {
params: {
"filter.Id": `;${ids.join(";")}`,
fields: ["Id", "FirstName", "LastName", "DisplayEmail"].join(","),
fields: ["Id", "FullName", "DisplayEmail"].join(","),
},
})
.pipe(switchMap(decodeArray(PersonSummary)));
Expand Down
3 changes: 1 addition & 2 deletions src/spec-builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ export function buildPersonSummary(id: number): PersonSummary {
return {
Id: id,
DisplayEmail: null,
FirstName: "T",
LastName: "Tux",
FullName: "Tux",
};
}

Expand Down

0 comments on commit 04df09a

Please sign in to comment.