danmarsden / moodle-mod_attendance

Allows an attendance log to be kept in Moodle
https://moodle.org/plugins/mod_attendance
64 stars 155 forks source link

Restoring/importing attendance sessions behaviour #419

Open zpottie opened 5 years ago

zpottie commented 5 years ago

Hi Dan,

we've come across an issue when importing the attendance mod in our use-case, and I wanted to discuss/collaborate with you on a solution (if any is even needed).

We have courses that roll over from time to time and we use the attendance mod for taking attendance for the face-to-face sessions of our blended course. The issue is when importing the old course into a new one for the new intake of learners. Sessions are imported too and need to be deleted using the "Delete hidden sessions" button and select all & delete upcoming sessions that have been imported. Then we can add the sessions for the new intake.

While not a major task to do manually, I wanted to get your views on it.

For example, a potential solution could be a global or instance-based setting that toggles if sessions are also imported. And in this function and/or the backup file: https://github.com/danmarsden/moodle-mod_attendance/blob/master/backup/moodle2/restore_attendance_stepslib.php#L55-L56 there may be a check like:

if (get_config('mod_attendance', 'importsessions')) {
    $paths[] = new restore_path_element('attendance_session',
             '/activity/attendance/sessions/session');
}

I mostly raised this to get your thoughts on it. What do you think? :)

Thanks, Zander

danmarsden commented 5 years ago

Hi Zander, if we did this it sounds like something that should be implemented as a setting within the backup/restore classes to me so that it displays in the backup/restore UI as an option during the restore. Check out the define_my_settings() function in the backup/restore classes - I don't remember seeing an example of that in use though.

Pull requests always welcome! - thanks.