Group choice
Maintained by
Nicolas Dunand
This module allows students to enrol themselves in a group within a course. The teacher can select which groups students can chose from and the maximum number of students allowed in each group.
Comments
Comments are no longer open for new posts. Existing comments remain available to read.
Do you know, that in Choice module, on which your module base, team od developers is working about displaying terms in the calendar, upcoming events etc.. It is worth implementation in Group Choice too. Look at https://tracker.moodle.org/browse/MDL-11369 .
Cheers
Adam
Do you know if your plugin works with Moodle 3.1, do you plan to submit a compatible version ?
Thanks
Cheers, Emilie
On that note, please could I quickly query whether you have any plans to update the plugin to be fully compatible with Moodle v3.1, and its new Global Search feature in particular? To clarify: while we’ve tested the Group choice plugin under v3.1 and all of the core functionality seems to work fine, we’ve found that instances of the activity are not searchable via v3.1’s Global Search feature. Please see the following screenshot for details, which lists all of the available areas that can searched under v3.1 (note that these settings are available via: Site Administration -> Plugins -> Search -> Manage Global Search):
http://imgur.com/lWWQByE
Note also that the above screenshot was taken on a v3.1 system where the Group choice plugin is installed and available. However, as you can see, the Group choice activity is not listed as being available to be searched. Obviously, this is likely to be a significant problem/cause of confusion for users who might want to search for specific instances of the Group choice activity across Moodle.
I’m not a developer, but my understanding is that mod plugins can be made searchable relatively easily via the addition of a new search class within the plugin’s codebase (located at ../classes/search/activity.php). Please see the following for further details:
https://moodle.org/mod/forum/discuss.php?d=334938
https://docs.moodle.org/31/en/Global_search
https://docs.moodle.org/dev/Search_API
We really hope this search capability can be added to Group choice as I’m sure it would be a huge benefit to our users (as well as those of other v3.1 systems) and, again, many thanks for all your efforts to develop this plugin and share it with the community.
Best wishes,
Lina
Thanks. The newest version – Release 1.9 for Moodle 2.7-3.0 (Build: 2015121000) – explicitly supports Moodle 2.7-3.0.
I haven't gone back to check older versions for recent Moodle version support though.
Great plugin, can you please edit the details of the newest version and add Moodle branches 2.7, 2.8, 2.9 and 3.0 as supported Moodle branches.
The information on this page for Release 1.4.4 (Build: 2014010100) lists support for only Moodle 2.2, 2.3, 2.4, 2.5, 2.6.
Thanks.
yesterday I posted my reports in this page: https://github.com/ndunand/moodle-mod_choicegroup/issues/89 .
Sara
Thanks for getting back. This indeed shows some performance issues when the number of users grows. To see where the actual bottleneck is (which funciton/DB call), could you post the relevant call graph images in the issue tracker I linked to before?
I successfully installed the profiler and I made some test with Oracle using my test server, raising the number of the users enrolled in the course.
These are my results.
Date Execution time CPU time Function calls Memory used
19 feb 2016, 11:43 7380,011 ms 1851,150 ms 457474 17715,602 KB (3647 users)
18 feb 2016, 15:03 5584,185 ms 1380,543 ms 356292 16404,383 KB (2647 users)
18 feb 2016, 14:55 3696,570 ms 971,823 ms 235291 13701,648 KB (1547 users)
18 feb 2016, 14:41 860,882 ms 284,169 ms 61176 9357,852 KB (47 users)
If you want I can post my mpr files in the github page (it seems I can’t post any files o images here)
Thanks. Yes, you were clear, but in my case view.php was very fast, and only report.php showed a slight slowdown.
As for the DB system, I guess it could make a difference, but I've never used Oracle really.
To use profiling, you need to set up a few things. See https://docs.moodle.org/dev/Profiling_PHP#Profiling_a_page for a general introduction about profiling PHP in Moodle ( I use the XHProf method ) and https://docs.moodle.org/dev/Setting_up_xhprof_on_Moodle#Using_XHProf on how to set it up and use it.
thank you for your quick replay!!! I saw in the issue that you made a test for report.php file. Sorry, I wasn't clear. My test was about view.php. Report.php works well and it doesn't seem to have slowness problem.
I don't know if it can be useful, but I'm using Oracle. Thank you also for the suggestion of the profiling system. Could you please link me a guide on how to use it?
Thanks again for your feeback!
Sara
Thanks for your feedback and for offering a solution. I think your idea should work, but I'd need to run some more tests to see whether this would really address the problem.
I just ran a quick test on a (not very powerful) development server, in a course with 2 groups and about 2000 students, without experiencing real performance problems. For further investigation on this topic, I opened a new issue on the bug tracker for this module ( https://github.com/ndunand/moodle-mod_choicegroup/issues/89 ). Feel free to add to it!
Btw, I used Moodle's profiling system, which is great at tracking performance issues.
thank you very much for your plugin, it's very useful and we're using it in many courses with Moodle 2.8!
For example, we are using Group choice in a course to reinforce math knowledge. The enrolled students in this course are currently about 1200, but their number will grow in the near future.
Recently we noticed that the page of group selection has become slower.
The debug shows that the page executes 2281 queries with 1157 enrolled users in a course.
In a course with only 15 enrolled students the number of queries drops to 78.
With a quick debug I found out that the slow-down seems due to the function “choicegroup_get_response_data” . Its “Big function, approx 6 SQL calls per user” comment helped me.
The following function "choicegroup_get_user_answer" is called for each enrolled student to get the user response:
foreach ($allresponses[0] as $user) {
$currentanswers = choicegroup_get_user_answer($choicegroup, $user, true);
I tried to write this piece of code, replacing part of code inside choicegroup_get_response_data and mixing some of the functions you're using in group choice, to retrieve the responses:
if (is_numeric($choicegroup)) {
$choicegroupid = $choicegroup;
}
else {
$choicegroupid = $choicegroup->id;
}
$params1 = array('choicegroupid'=>$choicegroupid);
list($esql, $params2) = get_enrolled_sql($ctx, 'mod/choicegroup:choose', 0);
$params = array_merge($params1, $params2);
$sql = 'SELECT gm.*
FROM {user} u
JOIN ('.$esql.') je ON je.id = u.id
JOIN {groups_members} gm
ON gm.userid = u.id AND groupid IN (
SELECT groupid FROM {choicegroup_options} WHERE choicegroupid=:choicegroupid)
WHERE u.deleted = 0 ORDER BY u.lastname ASC,u.firstname ASC';
$usergroupmemberships = $DB->get_records_sql($sql, $params);
In this way I think it would be faster.
Changing this piece of code will obviously mean to change the part of the plugin that shows answers, but do you think that this change could work?
Thanks in advance,
Sara
I just made the required changes (and a couple others) and released an updated version of this plugin. The updated version now also supports officially Moodle 3.0.
We have experienced a problem when a lot of users (ca 250) tryed to use choicegroup simultaneously. Despite the limit of 15 users per group, up to 21 has successfully chosen the same groups.
I have prepared a fix for it.
To implement it, remove the rows 370 to 377 in lib.php and paste the code presented below at the same position.
We have tested this on ca 450 students waiting "in starting blocks" to choose a thesis supervisor. 350 of them have done it in 5 minutes without any problem
-------------------
groups_add_member($selected_option->groupid, $userid);
$groupmember_added = true;
if ($choicegroup->limitanswers) {
$groupmember = $DB->get_record('groups_members', array('groupid' => $selected_option->groupid, 'userid'=>$userid));
$select_count = 'groupid='.$selected_option->groupid.' and id<='.$groupmember->id;
$countanswers = $DB->count_records_select('groups_members', $select_count);
$maxans = $choicegroup->maxanswers[$formanswer];
if ($countanswers > $maxans) {
groups_remove_member($selected_option->groupid, $userid);
$groupmember_added = false;
}
}
if ($groupmember_added) {
----------
Best Regards
Adam Pawełczak