This PR replaces the automated logic for showing/hiding the "Form a group" menu item with a manual boolean setting, which is set at the course instance level. Note, that this PR requires a migration.
Why?
The previous implementation created way too many queries for each page load just to decide whether to show a menu item or not. The result should at least be cached if a manual setting is considered too much work for the course staff.
How?
A new boolean property group_work_allowed is added into the CourseInstance class. This is referenced in the course/templates/course/_course_menu.html template instead of checking whether the instance_max_group_size method returns a value greater than one.
Fixes #1367
This PR should be completed by adding checks to set the new boolean according to whether there are group-allowing assignments when data is imported via gitmanager. Also disabling the boolean could be prevented when an existing course has group-allowing assignments. User documentation would also need to be updated to include the new setting.
Testing
Remember to add or update unit tests for new features and changes.
Tested changing the "Students can form groups" setting in Edit course -> Course, and that the "Form a group" appears/disappears when clicking Save. Checked cloning the course instance, and that the setting from source instance persists.
Did you test the changes in
[x] Chrome
[ ] Firefox
[ ] This pull request cannot be tested in the browser.
Think of what is affected by these changes and could become broken
…ookup on every page load
Fixes #1367
Description
What?
This PR replaces the automated logic for showing/hiding the "Form a group" menu item with a manual boolean setting, which is set at the course instance level. Note, that this PR requires a migration.
Why?
The previous implementation created way too many queries for each page load just to decide whether to show a menu item or not. The result should at least be cached if a manual setting is considered too much work for the course staff.
How?
A new boolean property group_work_allowed is added into the CourseInstance class. This is referenced in the course/templates/course/_course_menu.html template instead of checking whether the instance_max_group_size method returns a value greater than one.
Fixes #1367
This PR should be completed by adding checks to set the new boolean according to whether there are group-allowing assignments when data is imported via gitmanager. Also disabling the boolean could be prevented when an existing course has group-allowing assignments. User documentation would also need to be updated to include the new setting.
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
Tested changing the "Students can form groups" setting in Edit course -> Course, and that the "Form a group" appears/disappears when clicking Save. Checked cloning the course instance, and that the setting from source instance persists.
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!