@@ -110,25 +112,25 @@ const shownCriteria = computed(() => {
class="border-b border-gray-500 flex flex-col lg:flex-row lg:items-center pb-4 mb-4"
>
diff --git a/client/src/pages/CompetencesMainView.vue b/client/src/pages/CompetencesMainView.vue
index 5e4287e8..7c305cce 100644
--- a/client/src/pages/CompetencesMainView.vue
+++ b/client/src/pages/CompetencesMainView.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/client/src/router/index.ts b/client/src/router/index.ts
index ef24b520..9d0db13e 100644
--- a/client/src/router/index.ts
+++ b/client/src/router/index.ts
@@ -53,7 +53,7 @@ const router = createRouter({
],
},
{
- path: "/competences/:competencesPageSlug",
+ path: "/competence/:competenceProfilePageSlug",
props: true,
component: () => import("@/pages/ComptencesView.vue"),
children: [
diff --git a/client/src/stores/competence.ts b/client/src/stores/competence.ts
new file mode 100644
index 00000000..ad4e5b82
--- /dev/null
+++ b/client/src/stores/competence.ts
@@ -0,0 +1,53 @@
+import { itGet } from "@/fetchHelpers";
+import type { CompetenceProfilePage } from "@/types";
+import _ from "lodash";
+import { defineStore } from "pinia";
+
+export type CompetenceStoreState = {
+ competenceProfilePage: CompetenceProfilePage | undefined;
+};
+
+export const useCompetenceStore = defineStore({
+ id: "competence",
+ state: () => {
+ return {
+ competenceProfilePage: undefined,
+ } as CompetenceStoreState;
+ },
+ getters: {
+ flatPerformanceCriteria: (state, circleTitle = "") => {
+ if (!state.competenceProfilePage) {
+ return [];
+ }
+
+ let criteria = _.orderBy(
+ state.competenceProfilePage.children.flatMap((competence) => {
+ return competence.children;
+ }),
+ ["competence_id"],
+ ["asc"]
+ );
+
+ if (circleTitle) {
+ criteria = criteria.filter((c) => c.circle === circleTitle);
+ }
+
+ return criteria;
+ },
+ },
+ actions: {
+ async loadCompetenceProfilePage(slug: string, reload = false) {
+ if (this.competenceProfilePage && !reload) {
+ return this.competenceProfilePage;
+ }
+ const competenceProfilePageData = await itGet(`/api/course/page/${slug}/`);
+
+ if (!competenceProfilePageData) {
+ throw `No competenceProfilePageData found with: ${slug}`;
+ }
+
+ this.competenceProfilePage = competenceProfilePageData;
+ return this.competenceProfilePage;
+ },
+ },
+});
diff --git a/client/src/types.ts b/client/src/types.ts
index 9470caee..64bfc94a 100644
--- a/client/src/types.ts
+++ b/client/src/types.ts
@@ -290,3 +290,23 @@ export interface MediaLibraryPage extends CourseWagtailPage {
course: Course;
children: MediaCategoryPage[];
}
+
+export interface PerformanceCriteria extends CourseWagtailPage {
+ type: "competence.PerformanceCriteria";
+ competence_id: string;
+ circle: string;
+ course_category: CourseCategory;
+ learning_unit: CourseWagtailPage;
+}
+
+export interface CompetencePage extends CourseWagtailPage {
+ type: "competence.CompetencePage";
+ competence_id: string;
+ children: PerformanceCriteria[];
+}
+
+export interface CompetenceProfilePage extends CourseWagtailPage {
+ type: "competence.CompetenceProfilePage";
+ course: Course;
+ children: CompetencePage[];
+}
diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json
index bea740ec..00819462 100644
--- a/client/tsconfig.app.json
+++ b/client/tsconfig.app.json
@@ -1,14 +1,27 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
- "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
- "exclude": ["src/**/__tests__/*"],
+ "include": [
+ "env.d.ts",
+ "src/**/*",
+ "src/**/*.vue"
+ ],
+ "exclude": [
+ "src/**/__tests__/*"
+ ],
"compilerOptions": {
+ "lib": [
+ "ES2021",
+ "DOM",
+ "DOM.Iterable"
+ ],
"composite": true,
"strict": true,
"allowJs": true,
"baseUrl": ".",
"paths": {
- "@/*": ["./src/*"]
+ "@/*": [
+ "./src/*"
+ ]
}
}
}
diff --git a/server/vbv_lernwelt/competence/models.py b/server/vbv_lernwelt/competence/models.py
index e61a7d7c..370a70bd 100644
--- a/server/vbv_lernwelt/competence/models.py
+++ b/server/vbv_lernwelt/competence/models.py
@@ -64,6 +64,7 @@ class CompetencePage(Page):
return get_it_serializer_class(
cls,
[
+ "competence_id",
"children",
],
)