Skip to content

Commit

Permalink
add studentCount column to table, add link to add class btn, tests am…
Browse files Browse the repository at this point in the history
…endments
  • Loading branch information
IgorCapCoder committed Oct 24, 2023
1 parent ff279cd commit fe4e73b
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pages/administration/ClassOverview.page.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
});
});
});
});
6 changes: 6 additions & 0 deletions src/pages/administration/ClassOverview.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
color="primary"
depressed
data-testid="admin-class-add-button"
:href="`/administration/classes/create`"
>
{{ t("pages.administration.classes.index.add") }}
</v-btn>
Expand Down Expand Up @@ -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: "",
Expand Down
6 changes: 6 additions & 0 deletions src/serverApi/v3/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ export interface ClassInfoResponse {
* @memberof ClassInfoResponse
*/
isUpgradable?: boolean;
/**
*
* @type {number}
* @memberof ClassInfoResponse
*/
studentCount: number;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/store/group/group.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class GroupMapper {
type: ClassRootTypeMapping[classInfoResponse.type],
id: classInfoResponse.id,
isUpgradable: classInfoResponse.isUpgradable,
studentCount: classInfoResponse.studentCount,
})
);

Expand Down
1 change: 1 addition & 0 deletions src/store/types/class-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type ClassInfo = {
type: ClassRootType;
id: string;
isUpgradable?: boolean;
studentCount: number;
};

export enum ClassRootType {
Expand Down
1 change: 1 addition & 0 deletions tests/test-utils/factory/classInfoFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const classInfoFactory = Factory.define<ClassInfo>(({ sequence }) => ({
teachers: ["TestTeacher"],
type: ClassRootType.Group,
id: `id-${sequence}`,
studentCount: 2,
}));
1 change: 1 addition & 0 deletions tests/test-utils/factory/classInfoResponseFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export const classInfoResponseFactory = Factory.define<ClassInfoResponse>(
teachers: ["TestTeacher"],
type: ClassInfoResponseTypeEnum.Class,
id: `id-${sequence}`,
studentCount: 2,
})
);

0 comments on commit fe4e73b

Please sign in to comment.