Skip to content

Commit

Permalink
Merge pull request #12992 from AllanOXDi/fix-class-route
Browse files Browse the repository at this point in the history
Fixes assigned lessons and quizzes are not visible to the learner
  • Loading branch information
rtibbles authored Jan 10, 2025
2 parents cb4ec2c + 34a398e commit 66ff3c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 6 additions & 0 deletions kolibri/plugins/learn/assets/src/routes/classesRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export default [
{
name: ClassesPageNames.CLASS_ASSIGNMENTS,
path: '/classes/:classId',
props: route => {
const classId = route.params.classId;
return {
classId,
};
},
handler: toRoute => {
const { classId } = toRoute.params;
return noClassesGuard() || showClassAssignmentsPage(store, classId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
:label="className"
/>
</h1>

<AssignedLessonsCards :lessons="activeLessons" />
<AssignedQuizzesCards
:quizzes="activeQuizzes"
Expand All @@ -31,7 +30,6 @@
<script>
import { computed, onBeforeMount, onBeforeUnmount } from 'vue';
import { get } from '@vueuse/core';
import KBreadcrumbs from 'kolibri-design-system/lib/KBreadcrumbs';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
Expand All @@ -57,16 +55,15 @@
LearnAppBarPage,
},
mixins: [commonCoreStrings, commonLearnStrings],
setup(_, { root }) {
setup(props) {
const { fetchClass, getClass, getClassActiveLessons, getClassActiveQuizzes } =
useLearnerResources();
const classId = root.$router.currentRoute.params.classId;
const classroom = computed(() => getClass(classId));
const className = computed(() => (get(classroom) ? get(classroom).name : ''));
const activeLessons = computed(() => getClassActiveLessons(get(classId)));
const activeQuizzes = computed(() => getClassActiveQuizzes(get(classId)));
const classId = computed(() => props.classId);
const classroom = computed(() => getClass(classId.value));
const className = computed(() => (classroom.value ? classroom.value.name : ''));
const activeLessons = computed(() => getClassActiveLessons(classId.value));
const activeQuizzes = computed(() => getClassActiveQuizzes(classId.value));
let pollTimeoutId;
function schedulePoll() {
Expand Down Expand Up @@ -98,6 +95,10 @@
type: Boolean,
default: false,
},
classId: {
type: String,
required: true,
},
},
computed: {
breadcrumbs() {
Expand All @@ -112,6 +113,7 @@
},
{
text: this.className,
link: { name: ClassesPageNames.CLASS_ASSIGNMENTS },
},
];
},
Expand Down

0 comments on commit 66ff3c0

Please sign in to comment.