Merge branch 'hotfix/missing-objectives-for-students' into develop

This commit is contained in:
Ramon Wenger 2022-05-10 09:37:33 +02:00
commit 52dbce85e0
2 changed files with 11 additions and 16 deletions

View File

@ -93,9 +93,6 @@
return this.module.objectiveGroups ? this.module.objectiveGroups return this.module.objectiveGroups ? this.module.objectiveGroups
.filter(group => group.title.toLowerCase() === 'interdisciplinary') : []; .filter(group => group.title.toLowerCase() === 'interdisciplinary') : [];
}, },
isStudent() {
return !this.me.permissions.includes('users.can_manage_school_class_content');
},
note() { note() {
if (!(this.module && this.module.bookmark)) { if (!(this.module && this.module.bookmark)) {
return; return;

View File

@ -14,26 +14,24 @@
export default { export default {
props: { props: {
groups: Array, groups: {
control: { type: Array,
type: Boolean, default: () => ([]),
default: false },
}
}, },
components: { components: {
ObjectiveGroup ObjectiveGroup,
}, },
apollo: { apollo: {
me: meQuery me: meQuery,
}, },
data() { data() {
return { return {
me: { me: {
permissions: [] },
}
}; };
}, },
@ -46,18 +44,18 @@
a teacher should get multiple blocks, so he can manage the visibility for his students. a teacher should get multiple blocks, so he can manage the visibility for his students.
students don't care about the blocks, so they should get just one block that contains all the objectives students don't care about the blocks, so they should get just one block that contains all the objectives
*/ */
if (this.me.permissions.includes('users.can_manage_school_class_content') || !this.groups.length) { if (this.me.isTeacher || !this.groups.length) {
return this.groups; return this.groups;
} else { } else {
// todo: maybe this can be done a bit more elegantly // todo: maybe this can be done a bit more elegantly
let groups = this.groups; let groups = this.groups;
const objectives = groups.map(g => g.objectives).flat(); // get all objectives in one array const objectives = groups.map(g => g.objectives).flat(); // get all objectives in one array
const firstGroup = Object.assign({}, groups.shift(), {objectives}); const firstGroup = Object.assign({}, groups[0], {objectives});
return [firstGroup]; return [firstGroup];
} }
} },
} },
}; };
</script> </script>