Fix bug when loading courseSessions and its users
This commit is contained in:
parent
dcf42934b1
commit
cbd14abe65
|
|
@ -28,7 +28,7 @@ onMounted(async () => {
|
|||
<h1 data-cy="welcome-message">
|
||||
{{ $t("dashboard.welcome", { name: userStore.first_name }) }}
|
||||
</h1>
|
||||
<div class="mb-14">
|
||||
<div v-if="courseSessionsStore.courseSessions.length > 0" class="mb-14">
|
||||
<h2 class="mt-12 mb-3">Kurse</h2>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 auto-rows-fr">
|
||||
|
|
|
|||
|
|
@ -34,23 +34,15 @@ function loadCourseSessionsData(reload = false) {
|
|||
});
|
||||
|
||||
// TODO: refactor after implementing of Klassenkonzept
|
||||
const uniqueCourses = _.uniqBy(courseSessions.value, "course.id");
|
||||
await Promise.all(
|
||||
uniqueCourses.map(async (courseSession) => {
|
||||
courseSessions.value.map(async (cs) => {
|
||||
const users = (await itGetCached(
|
||||
`/api/course/sessions/${courseSession.course.slug}/users/`,
|
||||
`/api/course/sessions/${cs.course.slug}/users/`,
|
||||
{
|
||||
reload: reload,
|
||||
}
|
||||
)) as CourseSessionUser[];
|
||||
courseSessions.value = courseSessions.value
|
||||
.filter((cs) => {
|
||||
return cs.course.slug === courseSession.course.slug;
|
||||
})
|
||||
.map((cs) => {
|
||||
cs.users = users;
|
||||
return cs;
|
||||
});
|
||||
cs.users = users;
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue