({ rootGetters, dispatch, getters })
| 422 | }, |
| 423 | |
| 424 | resetProgress ({ rootGetters, dispatch, getters }) { |
| 425 | const students = getters.selectedStudentIds.map(id => rootGetters['teacherDashboard/getMembersCurrentClassroom'].find(({ _id }) => id === _id)) |
| 426 | const currentClassroom = rootGetters['teacherDashboard/getCurrentClassroom'] |
| 427 | const courseInstances = rootGetters['courseInstances/getCourseInstancesOfClass'](currentClassroom._id) |
| 428 | const selectedCourseId = rootGetters['teacherDashboard/getSelectedCourseIdCurrentClassroom'] |
| 429 | const courseInstance = courseInstances.find(ci => ci.courseID === selectedCourseId) |
| 430 | const courses = rootGetters['courses/sorted'] |
| 431 | const selectedCourse = courses.find(c => c._id === selectedCourseId) |
| 432 | if (!selectedCourse || students.length === 0 || !courseInstance) { |
| 433 | return noty({ |
| 434 | text: $.i18n.t('teacher_dashboard.no_progress_to_delete'), |
| 435 | type: 'error', |
| 436 | timeout: 2000, |
| 437 | layout: 'center' |
| 438 | }) |
| 439 | } |
| 440 | if (window.confirm($.i18n.t('teacher_dashboard.delete_progress_warning', { courseName: selectedCourse.name }))) { |
| 441 | noty({ |
| 442 | text: $.i18n.t('teacher_dashboard.deleting_progress'), |
| 443 | timeout: 200, |
| 444 | type: 'information', |
| 445 | layout: 'center' |
| 446 | }) |
| 447 | dispatch('levelSessions/resetProgressOfUsers', { users: students, courseInstanceId: courseInstance._id, currentClassroom }, { root: true }) |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | } |
nothing calls this directly
no test coverage detected