Load separate competence profile for every user
This commit is contained in:
parent
0adf734846
commit
0cbce3c42b
|
|
@ -2,12 +2,20 @@
|
||||||
import ItPersonRow from "@/components/ui/ItPersonRow.vue";
|
import ItPersonRow from "@/components/ui/ItPersonRow.vue";
|
||||||
import ItProgress from "@/components/ui/ItProgress.vue";
|
import ItProgress from "@/components/ui/ItProgress.vue";
|
||||||
import { useCockpitStore } from "@/stores/cockpit";
|
import { useCockpitStore } from "@/stores/cockpit";
|
||||||
|
import { useCompetenceStore } from "@/stores/competence";
|
||||||
import * as log from "loglevel";
|
import * as log from "loglevel";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
log.debug("CockpitIndexPage created");
|
log.debug("CockpitIndexPage created");
|
||||||
|
|
||||||
const cockpitStore = useCockpitStore();
|
const cockpitStore = useCockpitStore();
|
||||||
|
const competenceStore = useCompetenceStore();
|
||||||
|
|
||||||
|
function userCountStatus(userId: number) {
|
||||||
|
return competenceStore.calcStatusCount(
|
||||||
|
competenceStore.flatPerformanceCriteria(userId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
circles: ["KMU Teil 1", "KMU Teil 2", "3-Säuli-Prinzip"],
|
circles: ["KMU Teil 1", "KMU Teil 2", "3-Säuli-Prinzip"],
|
||||||
|
|
@ -107,19 +115,25 @@ function setActiveCircle(index: number) {
|
||||||
<it-icon-smiley-thinking
|
<it-icon-smiley-thinking
|
||||||
class="w-8 h-8 mr-2 inline-block"
|
class="w-8 h-8 mr-2 inline-block"
|
||||||
></it-icon-smiley-thinking>
|
></it-icon-smiley-thinking>
|
||||||
<p class="text-bold inline-block">2</p>
|
<p class="text-bold inline-block">
|
||||||
|
{{ userCountStatus(csu.user_id).fail }}
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex flex-row items-center mr-6">
|
<li class="flex flex-row items-center mr-6">
|
||||||
<it-icon-smiley-happy
|
<it-icon-smiley-happy
|
||||||
class="w-8 h-8 mr-2 inline-block"
|
class="w-8 h-8 mr-2 inline-block"
|
||||||
></it-icon-smiley-happy>
|
></it-icon-smiley-happy>
|
||||||
<p class="text-bold inline-block">5</p>
|
<p class="text-bold inline-block">
|
||||||
|
{{ userCountStatus(csu.user_id).success }}
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex flex-row items-center">
|
<li class="flex flex-row items-center">
|
||||||
<it-icon-smiley-neutral
|
<it-icon-smiley-neutral
|
||||||
class="w-8 h-8 mr-2 inline-block"
|
class="w-8 h-8 mr-2 inline-block"
|
||||||
></it-icon-smiley-neutral>
|
></it-icon-smiley-neutral>
|
||||||
<p class="text-bold inline-block">5</p>
|
<p class="text-bold inline-block">
|
||||||
|
{{ userCountStatus(csu.user_id).unknown }}
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useCockpitStore } from "@/stores/cockpit";
|
import { useCockpitStore } from "@/stores/cockpit";
|
||||||
|
import { useCompetenceStore } from "@/stores/competence";
|
||||||
import * as log from "loglevel";
|
import * as log from "loglevel";
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
|
|
||||||
|
|
@ -10,12 +11,19 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const cockpitStore = useCockpitStore();
|
const cockpitStore = useCockpitStore();
|
||||||
|
const competenceStore = useCompetenceStore();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
log.debug("CockpitParentPage mounted", props.courseSlug);
|
log.debug("CockpitParentPage mounted", props.courseSlug);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await cockpitStore.loadCourseSessionUsers(props.courseSlug);
|
await cockpitStore.loadCourseSessionUsers(props.courseSlug);
|
||||||
|
cockpitStore.courseSessionUsers?.forEach((csu) => {
|
||||||
|
competenceStore.loadCompetenceProfilePage(
|
||||||
|
props.courseSlug + "-competence",
|
||||||
|
csu.user_id
|
||||||
|
);
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(error);
|
log.error(error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,13 @@ export const useCompetenceStore = defineStore({
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
userId = userStore.id;
|
userId = userStore.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.competenceProfilePages.get(userId) && !reload) {
|
||||||
|
const competenceProfilePage = this.competenceProfilePages.get(userId);
|
||||||
|
await this.parseCompletionData(userId);
|
||||||
|
return competenceProfilePage;
|
||||||
|
}
|
||||||
|
|
||||||
const competenceProfilePage = await itGetCached(`/api/course/page/${slug}/`, {
|
const competenceProfilePage = await itGetCached(`/api/course/page/${slug}/`, {
|
||||||
reload: reload,
|
reload: reload,
|
||||||
});
|
});
|
||||||
|
|
@ -131,7 +138,7 @@ export const useCompetenceStore = defineStore({
|
||||||
throw `No competenceProfilePageData found with: ${slug}`;
|
throw `No competenceProfilePageData found with: ${slug}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.competenceProfilePages.set(userId, competenceProfilePage);
|
this.competenceProfilePages.set(userId, _.cloneDeep(competenceProfilePage));
|
||||||
|
|
||||||
const circles = competenceProfilePage.circles.map((c: CircleLight) => {
|
const circles = competenceProfilePage.circles.map((c: CircleLight) => {
|
||||||
return { id: c.translation_key, name: `Circle: ${c.title}` };
|
return { id: c.translation_key, name: `Circle: ${c.title}` };
|
||||||
|
|
@ -167,6 +174,8 @@ export const useCompetenceStore = defineStore({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.competenceProfilePages.set(userId, competenceProfilePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Course(models.Model):
|
||||||
verbose_name = _("Lehrgang")
|
verbose_name = _("Lehrgang")
|
||||||
|
|
||||||
def get_course_url(self):
|
def get_course_url(self):
|
||||||
return f'/course/{self.slug}'
|
return f"/course/{self.slug}"
|
||||||
|
|
||||||
def get_learning_path_url(self):
|
def get_learning_path_url(self):
|
||||||
from vbv_lernwelt.learnpath.models import LearningPath
|
from vbv_lernwelt.learnpath.models import LearningPath
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue