Skip to content
Snippets Groups Projects
Commit a9cbc9be authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Fixed student list bug when decrypted

parent aa8aa77c
No related branches found
No related tags found
1 merge request!91Added reverse mapping of student list data
Pipeline #
......@@ -46,13 +46,14 @@
return map
},
reverseMapStudents (studentMap) {
const mappedStudents = Object.values({...this.$store.state.students}).map(student => {
return {
...student,
...studentMap[student.matrikel_no]
}
})
this.$store.commit('SET_STUDENTS', mappedStudents)
// const mappedStudents = Object.values({...this.$store.state.students}).map(student => {
// return {
// ...student,
// ...studentMap[student.matrikel_no]
// }
// })
this.$store.commit('SET_STUDENT_MAP', studentMap)
this.$store.commit('SET_STUDENTS', Object.values(this.$store.state.students))
}
}
}
......
......@@ -13,6 +13,7 @@ export const mut = Object.freeze({
SET_EXAM_TYPES: 'SET_EXAM_TYPES',
SET_STUDENTS: 'SET_STUDENTS',
SET_STUDENT: 'SET_STUDENT',
SET_STUDENT_MAP: 'SET_STUDENT_MAP',
SET_TUTORS: 'SET_TUTORS',
SET_SUBMISSION: 'SET_SUBMISSION',
SET_ALL_FEEDBACK: 'SET_ALL_FEEDBACK',
......@@ -60,15 +61,18 @@ const mutations = {
},
[mut.SET_STUDENTS] (state, students) {
state.students = students.reduce((acc, curr) => {
acc[curr.pk] = curr
acc[curr.pk] = mapStudent(curr, state.studentMap)
return acc
}, {})
},
[mut.SET_STUDENT] (state, student) {
Vue.set(state.students, student.pk, {
Vue.set(state.students, student.pk, mapStudent({
...state.students[student.pk],
...student
})
}, state.studentMap))
},
[mut.SET_STUDENT_MAP] (state, map) {
state.studentMap = map
},
[mut.SET_TUTORS] (state, tutors) {
state.tutors = tutors
......@@ -129,4 +133,14 @@ const mutations = {
}
}
function mapStudent (student, map) {
if (Object.keys(map).length > 0) {
return {
...student,
...map[student.matrikel_no]
}
}
return student
}
export default mutations
......@@ -24,6 +24,7 @@ export function initialState () {
subscriptions: {},
assignments: {},
students: {},
studentMap: {}, // is used to map obfuscated student data back to the original
statistics: {
submission_type_progress: []
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment