Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After Moodle upgrade to 3.11.6 groups to select are lost during the backup/restore process #168

Closed
adamtppaw opened this issue Jun 23, 2022 · 2 comments
Assignees

Comments

@adamtppaw
Copy link
Contributor

Hi,
we have upgraded of Moodle from 3.11.5 to 3.11.6. We havn't changed the Group choice version ('1.33 for Moodle 3.5-3.11 (Build: 2021083100)';).

Hhen we make a copy of a course containing Group choice activity, list of defined groups to select are lost (the right panel is empty).
The same we have observed in 3.11.7.

Adam

@adamtppaw
Copy link
Contributor Author

After investigation we have noticed that 5th of may there was a change in a code of plugin without change the version number in version.php. That is why we weren't aware of code change (we take it from github).

This change (5 may) raises the problem of losing groups to choose. Probably it occures only when you use postgresql instead of mysql.
Solution:
In a file backup/moodle2/restore_choicegroup_stepslib.php in line 75 change the function $DB->get_recordset_sql to $DB->record_exists_sql

After this change problem seems to be resolved.
Please remember to raise value of $plugin->version = 2021083100; in version.php .

adamtppaw added a commit to adamtppaw/moodle-mod_choicegroup that referenced this issue Jun 24, 2022
LiFaytheGoblin added a commit to LiFaytheGoblin/moodle-mod_choicegroup that referenced this issue Aug 2, 2022
…-to-choose-while-restore

ndunand#168 fix lost groups to choose while restore
@voegii
Copy link
Contributor

voegii commented Jan 12, 2023

We had the problem on copying (backup and restore) courses. The groups were lost in the choicegroup settings resp. the group ids referred to the original course.
Fix adamtppaw@96ef52e has solved it for us.
Thank you.

To get and fix wrong choicegroup options in existing courses we used this (! no warranty !):

SELECT mdl_choicegroup_options.id, mdl_choicegroup_options.groupid as groupid_wrong, mdl_choicegroup.id as choicegroupid, mdl_choicegroup.course as choicegroup_course, mdl_groups.courseid as group_course, mdl_groups.name, mdl_groups_correct.id as groupid_correct, mdl_course.shortname 
FROM mdl_choicegroup_options 
LEFT JOIN mdl_choicegroup ON mdl_choicegroup.id = mdl_choicegroup_options.choicegroupid 
LEFT JOIN mdl_groups ON mdl_groups.id = mdl_choicegroup_options.groupid 
LEFT JOIN mdl_groups as mdl_groups_correct ON mdl_groups_correct.courseid = mdl_choicegroup.course AND mdl_groups_correct.name = mdl_groups.name 
LEFT JOIN mdl_course ON mdl_course.id = mdl_choicegroup.course 
WHERE mdl_choicegroup.course <> mdl_groups.courseid;

UPDATE mdl_choicegroup_options 
LEFT JOIN mdl_choicegroup ON mdl_choicegroup.id = mdl_choicegroup_options.choicegroupid 
LEFT JOIN mdl_groups ON mdl_groups.id = mdl_choicegroup_options.groupid 
LEFT JOIN mdl_groups as mdl_groups_correct ON mdl_groups_correct.courseid = mdl_choicegroup.course AND mdl_groups_correct.name = mdl_groups.name 
SET mdl_choicegroup_options.groupid = mdl_groups_correct.id 
WHERE mdl_choicegroup.course <> mdl_groups.courseid and mdl_groups_correct.id IS NOT NULL;

NicoAlexH added a commit that referenced this issue Jan 30, 2023
NicoAlexH added a commit to adamtppaw/moodle-mod_choicegroup that referenced this issue Jan 30, 2023
NicoAlexH added a commit that referenced this issue Jan 30, 2023
…-while-restore

#168 fix lost groups to choose while restore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants