Display missing objectives for students again

This commit is contained in:
Ramon Wenger 2022-05-10 09:36:28 +02:00
parent 1d759b9272
commit edf5898a77
2 changed files with 11 additions and 16 deletions

View File

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

View File

@ -14,26 +14,24 @@
export default {
props: {
groups: Array,
control: {
type: Boolean,
default: false
}
groups: {
type: Array,
default: () => ([]),
},
},
components: {
ObjectiveGroup
ObjectiveGroup,
},
apollo: {
me: meQuery
me: meQuery,
},
data() {
return {
me: {
permissions: []
}
},
};
},
@ -46,18 +44,18 @@
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
*/
if (this.me.permissions.includes('users.can_manage_school_class_content') || !this.groups.length) {
if (this.me.isTeacher || !this.groups.length) {
return this.groups;
} else {
// todo: maybe this can be done a bit more elegantly
let groups = this.groups;
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];
}
}
}
},
},
};
</script>