From edf5898a779750b32da05cc9f2bcd825786ef29d Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 10 May 2022 09:36:28 +0200 Subject: [PATCH] Display missing objectives for students again --- client/src/components/modules/Module.vue | 3 --- .../objective-groups/ObjectiveGroups.vue | 24 +++++++++---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/client/src/components/modules/Module.vue b/client/src/components/modules/Module.vue index b521916c..a4d576e5 100644 --- a/client/src/components/modules/Module.vue +++ b/client/src/components/modules/Module.vue @@ -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; diff --git a/client/src/components/objective-groups/ObjectiveGroups.vue b/client/src/components/objective-groups/ObjectiveGroups.vue index 59ced210..7ecb809c 100644 --- a/client/src/components/objective-groups/ObjectiveGroups.vue +++ b/client/src/components/objective-groups/ObjectiveGroups.vue @@ -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]; } - } - } + }, + }, };