diff --git a/src/pages/administration/ClassOverview.page.unit.ts b/src/pages/administration/ClassOverview.page.unit.ts index 690f712554..0d0d4a968e 100644 --- a/src/pages/administration/ClassOverview.page.unit.ts +++ b/src/pages/administration/ClassOverview.page.unit.ts @@ -520,4 +520,28 @@ describe("ClassOverview", () => { }); }); }); + + describe("addClass", () => { + describe("when clicking on add class buttton", () => { + const setup = () => { + const { wrapper } = getWrapper(); + + return { + wrapper, + }; + }; + + it("should redirect to legacy create class page", () => { + const { wrapper } = setup(); + + const addClassBtn = wrapper.find( + '[data-testid="admin-class-add-button"]' + ); + + expect(addClassBtn.attributes().href).toStrictEqual( + "/administration/classes/create" + ); + }); + }); + }); }); diff --git a/src/pages/administration/ClassOverview.page.vue b/src/pages/administration/ClassOverview.page.vue index e9654a09c4..71b9180b1c 100644 --- a/src/pages/administration/ClassOverview.page.vue +++ b/src/pages/administration/ClassOverview.page.vue @@ -129,6 +129,7 @@ color="primary" depressed data-testid="admin-class-add-button" + :href="`/administration/classes/create`" > {{ t("pages.administration.classes.index.add") }} @@ -248,6 +249,11 @@ export default defineComponent({ text: t("common.labels.teacher"), sortable: true, }, + { + value: "studentCount", + text: "Schüler:innen", + sortable: true, + }, { value: "actions", text: "", diff --git a/src/serverApi/v3/api.ts b/src/serverApi/v3/api.ts index c11606e3c8..720a33bd21 100644 --- a/src/serverApi/v3/api.ts +++ b/src/serverApi/v3/api.ts @@ -407,6 +407,12 @@ export interface ClassInfoResponse { * @memberof ClassInfoResponse */ isUpgradable?: boolean; + /** + * + * @type {number} + * @memberof ClassInfoResponse + */ + studentCount: number; } /** diff --git a/src/store/group/group.mapper.ts b/src/store/group/group.mapper.ts index 602b759f63..366cd39e8a 100644 --- a/src/store/group/group.mapper.ts +++ b/src/store/group/group.mapper.ts @@ -19,6 +19,7 @@ export class GroupMapper { type: ClassRootTypeMapping[classInfoResponse.type], id: classInfoResponse.id, isUpgradable: classInfoResponse.isUpgradable, + studentCount: classInfoResponse.studentCount, }) ); diff --git a/src/store/types/class-info.ts b/src/store/types/class-info.ts index bb36fe2ac2..8e1d6fdfe1 100644 --- a/src/store/types/class-info.ts +++ b/src/store/types/class-info.ts @@ -5,6 +5,7 @@ export type ClassInfo = { type: ClassRootType; id: string; isUpgradable?: boolean; + studentCount: number; }; export enum ClassRootType { diff --git a/tests/test-utils/factory/classInfoFactory.ts b/tests/test-utils/factory/classInfoFactory.ts index 3d44a9797c..53a449e281 100644 --- a/tests/test-utils/factory/classInfoFactory.ts +++ b/tests/test-utils/factory/classInfoFactory.ts @@ -7,4 +7,5 @@ export const classInfoFactory = Factory.define(({ sequence }) => ({ teachers: ["TestTeacher"], type: ClassRootType.Group, id: `id-${sequence}`, + studentCount: 2, })); diff --git a/tests/test-utils/factory/classInfoResponseFactory.ts b/tests/test-utils/factory/classInfoResponseFactory.ts index 5a18efe7e8..a1f0e48931 100644 --- a/tests/test-utils/factory/classInfoResponseFactory.ts +++ b/tests/test-utils/factory/classInfoResponseFactory.ts @@ -8,5 +8,6 @@ export const classInfoResponseFactory = Factory.define( teachers: ["TestTeacher"], type: ClassInfoResponseTypeEnum.Class, id: `id-${sequence}`, + studentCount: 2, }) );