Display solutions for teachers always

This commit is contained in:
Ramon Wenger 2019-09-16 14:02:28 +02:00
parent bfbe0b38ff
commit e940066db8
2 changed files with 16 additions and 3 deletions

View File

@ -0,0 +1,3 @@
export const isTeacher = (self) => {
return self.me.permissions.includes('users.can_manage_school_class_content')
};

View File

@ -3,7 +3,7 @@
<h1 class="survey-page__title">{{title}}</h1> <h1 class="survey-page__title">{{title}}</h1>
<survey :survey='survey'></survey> <survey :survey='survey'></survey>
<solution :value="solution" v-if="module.solutionsEnabled"></solution> <solution :value="solution" v-if="module.solutionsEnabled || isTeacher"></solution>
<div v-if="surveyComplete"> <div v-if="surveyComplete">
<a class="button button--primary" @click="reopen">Übung bearbeiten</a> <a class="button button--primary" @click="reopen">Übung bearbeiten</a>
</div> </div>
@ -20,6 +20,9 @@
import Solution from '@/components/content-blocks/Solution'; import Solution from '@/components/content-blocks/Solution';
import {extractSurveySolutions} from '@/helpers/survey-solutions'; import {extractSurveySolutions} from '@/helpers/survey-solutions';
import {isTeacher} from '@/helpers/is-teacher';
import {meQuery} from '@/graphql/queries';
const Survey = SurveyVue.Survey; const Survey = SurveyVue.Survey;
@ -35,7 +38,10 @@
return { return {
survey: this.initSurvey(), survey: this.initSurvey(),
title: '', title: '',
module: {} module: {},
me: {
permissions: []
},
} }
}, },
@ -61,6 +67,9 @@
return this.survey.currentPage && this.survey.currentPage.elements return this.survey.currentPage && this.survey.currentPage.elements
? this.survey.currentPage.elements.reduce(extractSurveySolutions, []) ? this.survey.currentPage.elements.reduce(extractSurveySolutions, [])
: [] : []
},
isTeacher() {
return isTeacher(this);
} }
}, },
@ -173,7 +182,8 @@
}); });
} }
}, },
} },
me: meQuery
} }
} }
</script> </script>