## Activities: Fair Allocation

mod_ratingallocate
Maintained by Learnweb – University of Münster, Tobias Reischmann, Ulm University
This Module lets you add an activity to courses, in which users can rate choices. You may then distribute the users fairly to the choices by maximizing overall 'happiness' in terms of ratings. This may be an alternative to the choice activity or first-come-first-served.
319 sites
37 fans
Current versions available: 8

In the area of schools or universities, there are often allocation problems, where a group of pupils or students needs to be assigned to a bunch of resources. These resources may be study groups, thesis topics, or seminar slots.
Therefore often techniques as first come first serve are used, which is not seldom perceived as unfair by the students.

To reach a high acceptance for the distribution technique is module offers the students the possibility to rate the possible choices according to their preferences. For this purpose the module supports multiple different rating strategies (e.g. Yes-No, Order, Points, Likert-scale).
After a predefined time period for the users to hand in their preferences, the distribution can be started. Here, an algorithm solves the distribution problem by maximizing the overall satisfaction.

• Choices have maximum sizes
• After the automated distribution, the allocations can be changed manually (including students with no rating)
• The students can be notified about their allocation via e-mail

We appreciate your commendation and reviews for this plugin in the comments. For bug reports and support requests create a ticket in the bug tracker which is linked below.

### Contributors

Learnweb – University of Münster (Lead maintainer)
Tobias Reischmann: Maintainer
Max Schulze: Initial committer
Alexander Bias: Feature contributor
Claus A. Us: Former Maintainer

• Tue, Dec 13, 2016, 3:18 PM
Hi Tobias,
Thanks a lot for this wonderful plugin. We've used this plugin to support the optional course allocation for all the students in our University. We love this plugin.
Students have provided many feedbacks. One of the most important feedback is about the allocation result. Could you please help to check this feedback and to see if you could help with the function which we really need?
Here's the detail information:

We've selected "Rank Choices" as the rating strategy. Take the monday's optional courses for example. There will be 10 optional courses for 1000 students to choose. Each students can rank the 10 options from 1 to 10. But since this is optional courses, many students only want to attend their favorite courses. They want to have a function which they can select the courses that they don't want to attend. So that system won't allocate them into these courses.

Many thanks.
Best wishes,
Lina
• Thu, Dec 15, 2016, 10:22 PM
Hey Thomas,
you can find this information here: https://github.com/learnweb/moodle-mod_ratingallocate#algorithm
Best wishes,
Tobias
• Tue, Jan 10, 2017, 5:05 AM
Hi Tobias,

is there a reason that 3.2-r1 (which does not add more than a language string according to https://github.com/learnweb/moodle-mod_ratingallocate/commits/master) is published but set to "unavailable" here?

Thanks,
Alex
• Wed, Jan 11, 2017, 2:50 AM
Hey Alex,
the version 3.2-r1 does add one important aspect, which is the support of moodle 3.2. When I created this patch, I already read through all change logs for the new version and all should still work as before. However, there were changes in the behat framework and therefore the automatic tests fail currently. Until now I was not able to identify or fix this issue, which is why I do not want to publish a version with 3.2 support, yet. Behind the failures of the tests due to the changes in the behat framework other more severe failures could be hiding. Although, I don't think so, I set the version for now to unavailable.
I will publish the next version as soon as possible (probably end of February).
Best wishes,
Tobias
• Mon, Sep 18, 2017, 10:20 PM
Hi All,
This is my fisrt use of Fair Allocation.
I have this server environment :
Moodle 3.3.2 (Build: 20170911)
PhP : 7.1;8

The allocation are already published but when I chosse to creat groups from Allocation I have this error message :

""""""""""""""""""""""""""""""""""
Error writing to database
Debug info: Field 'description' doesn't have a default value
INSERT INTO mdl_groups (courseid,name,idnumber,timecreated,timemodified) VALUES(?,?,?,?,?)
[array (
0 => '5980',
1 => '01. Des œufs au pesticide (Ph Bou et JM Fra)',
2 => 'ratingallocate_c_6',
3 => 1505741865,
4 => 1505741865,
)]
Error code: dmlwriteexception
Stack trace:
line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 1274 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1320 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 251 of /group/lib.php: call to mysqli_native_moodle_database->insert_record()
line 627 of /mod/ratingallocate/locallib.php: call to groups_create_group()
line 756 of /mod/ratingallocate/locallib.php: call to ratingallocate->process_action_allocation_to_grouping()
line 61 of /mod/ratingallocate/view.php: call to ratingallocate->handle_view()
""""""""""""""""""""""""""""""""""""
Could you help me to fix this problem?
Thank you!
Gabriel
• Mon, Sep 18, 2017, 10:43 PM
Hi Gabriel,
it seems that for some reason your database does not allow to create entries within mdl_groups table without a description value defined. The install.xml of moodle within lib/db/install.xml states that the description field is allowed to be null. Additionally, there are multiple other locations in moodle code, where a group without a description is created.

diff --git a/locallib.php b/locallib.php
index 0323c21..cdbbf94 100644
--- a/locallib.php
+++ b/locallib.php
@@ -624,6 +624,7 @@ class ratingallocate {
$data->courseid =$this->course->id;
$data->name =$choices[$choice['key']]->title;$data->idnumber = $groupid; +$data->description = '';
$createdid = groups_create_group($data);
groups_assign_grouping($groupingid,$createdid);
$choiceids[$groupid]['groupid'] = \$createdid;

However, I do not consider this as a problem of this plugin.
Grettings
Tobias
• Mon, Sep 18, 2017, 11:10 PM
Thank you very much. The proposed code works perfectly.
• Thu, Oct 26, 2017, 2:58 PM
Did someone try this with a lot of (280) Students?
I think about using this to allocate Students in a project week.
280 Students
Students could give first, second and third priority course.
Is this plugin working for such a huge ammount of data?
Grettings
Patrick
• Fri, Oct 27, 2017, 5:32 PM
Hello Patrick,
our biggest usage scenario in a course is currently 30 choices and 868 users. With these amounts of data, the algorithm of the plugin is working fine. In newer versions of the plugin, the manual allocation form is also usable for huge usage scenarios and gives a good overview of the ratings and the allocations. In older version, this was not recommendable, so make sure to use at least v3.3-r1.
Greetings
Tobias
• Mon, May 7, 2018, 9:58 PM
This module sounds really great and we would love to use it for seat allocations. However, while doing the assignment we need to give higher priority to students from higher semesters not just the preferences provided by students. As far as I can see, this module does not support it. It would have to be an additional optional rating scale, I imagine.
• Tue, May 8, 2018, 10:41 PM
Hey Robert,
you are welcome to file ideas for future development in the issues of the github repository. However, your suggestion is not that easily implementable. Thus, I think we will not be able to develop it in near future.
Kind regards,
Tobias
• Fri, Mar 29, 2019, 9:30 PM
This is one of the most well thought-out and developed Moodle plugins I've ever seen. Great work!
• Sat, Aug 10, 2019, 12:24 AM
AG-Wahlen mit z.B. 20 - 30 Angebotenen AGs und einer Verteilung auf 1000 Schülern die 1. Wahl, 2. Wahl und 3. Wahl angeben. Wäre das mit dem Plugin umsetzbar?
• Tue, Aug 20, 2019, 8:00 PM
Hallo Andreas,
grundsätzlich ist das möglich. 20-30 Angebote mit 1000 Schülern lastet das Plugin auf jeden Fall gut aus. Wir haben das Plugin aber in Münster mit 850 Studierenden und 30 Wahlmöglichkeiten auch schon erfolgreich getestet. Die Ansichten zum Verteilungsüberblick und zur manuellen Änderung von einzelnen Zuordnungen sind inzwischen auch soweit, dass sie kein Problem in der Handhabung mit so vielen Schülern darstellen.
Ich empfehle dir vor der entgültigen Zuteilung einen Blick in das Moodle Wiki: https://docs.moodle.org/31/en/Ratingallocate#Alter_Allocation (Momentan ist warum auch immer nur das Wiki zu Version 3.1 auf dem aktuellsten Stand, ich pflege das gleich in den anderen Versionen nach).
Ich hoffe das Plugin unterstützt dich gut bei der Verteilung!
VG
Tobias
• Tue, Mar 31, 2020, 6:33 PM
Hallo Community
Kann ich dieses Plugin verwenden, um eine Faire Aus-Wahl zu treffen? Meine Gruppe soll aus 12 Themen-Vorschlägen eine Wahl von 3 Themen treffen. Diese 3 Themen sollen für alle akzeptabel sein.
Worauf muss ich bei der Ersterstellung achten? Gibt es für meinen Bedarf bessere Plugins/Services?
Besten Dank für eure Hilfe.
LG
Michael