Activities: Fair Allocation

Maintained by WWU logo small Learnweb – University of Münster, Picture of Tobias Reischmann Tobias Reischmann, Picture of Ulm University 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 maximising overall 'hapiness' in terms of ratings. This may be an alternative to the choice activity or first-come-first-served.
150 sites
27 fans

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, Lickert-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.

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

No support in the comments section on this page

Please note that we don't provide any support for this plugin in the comments section on this page anymore.

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.

Thanks for your cooperation.


Screenshot #0
Screenshot #1


WWU logo small
Learnweb – University of Münster (Lead maintainer)
Picture of Tobias Reischmann
Tobias Reischmann: Maintainer
Picture of Max Schulze
Max Schulze: Initial committer
Picture of Alexander Bias
Alexander Bias: Feature contributor
Picture of Claus A. Us
Claus A. Us: Former Maintainer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Lina
    Tue, 16 Aug 2016, 10:27 AM
    Hi Tobias,
    Many thanks for your kind help. That's really helpful. I've changed the code in ratingallocate/renderer.php and added the idnumber field into the export function and it works. We can now export the student ID information.
    $ratingscells[$user->id][3] = $user->idnumber;

    Thanks again for the UTF8 issue, I've tried the data import function in Microsoft Excel, I changed the file origin to UTF-8, Chinese GB, simplified Chinese (Mac), simplified Chinese(Windows), I tried all the possible options but still cannot get the correct Chinese character. We will ask teachers to use English only as a temp solution.
    Thanks for you help. We really appreciate it.
    Best wishes,
  • Picture of Tobias Reischmann
    Tue, 16 Aug 2016, 3:17 PM
    Hi Lina,
    I checked the encoding issue again. For me it is working with 65001 : Unicode (UTF-8).
    However this might be dependend on the platform your server runs on or its configuration. Indeed the plugin itself does not define the encoding for the file.
    You can find the encoding of your server using YOURMOODLEINSTANCE/admin/phpinfo.php.
    There the encoding is displayed at Content-Type -> charset and at default_charset.
    I hope that information is helpful.
    Best wishes,
  • Lina
    Thu, 18 Aug 2016, 11:33 AM

    Hi Tobias,
    Thanks for your prompt reply. I really appreciate it. I've installed the new release and it is good that we can export the email information now. I like the other features in the new release. Many thanks for your great contributions.
    About the encoding issue, I've checked the phpinfo.php on our server and it shows the following information:
    Content-Type text/html; charset=utf-8

    The charset is utf-8, but didn't show if it is unicode or not. I'm reading this article:
    From that article that I need to many changes to my moodle instance, I will investigate more about this.
    Many thanks for your help.
    Best wishes,
  • Picture of Thomas Korner
    Mon, 28 Nov 2016, 7:41 PM
    Hi Tobias,
    I have a request from a costumer. He's interested in the details of the algorithms used. I didn't found any additional information. Could you add some links or information to the documentation?
    Best wishes,
  • Lina
    Tue, 13 Dec 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.

    Would you please help to see if we can have this function?
    Many thanks.
    Best wishes,
  • Picture of Tobias Reischmann
    Thu, 15 Dec 2016, 10:22 PM
    Hey Thomas,
    you can find this information here:
    Best wishes,
  • Picture of Alexander Bias
    Tue, 10 Jan 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 is published but set to "unavailable" here?

  • Picture of Tobias Reischmann
    Wed, 11 Jan 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,
  • Picture of Gabriel JALAM
    Mon, 18 Sep 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
    MariaDb : 5.5.52

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

    Error writing to database
    More information about this error
    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!
  • Picture of Tobias Reischmann
    Mon, 18 Sep 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.

    If you want a hotfix for your problem, you can add this line to your code:

    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.
  • Picture of Gabriel JALAM
    Mon, 18 Sep 2017, 11:10 PM
    Thank you very much. The proposed code works perfectly.
  • Picture of Patrick Schaerer
    Thu, 26 Oct 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
    about 20 courses
    Students could give first, second and third priority course.
    Is this plugin working for such a huge ammount of data?
  • Picture of Tobias Reischmann
    Fri, 27 Oct 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.
  • Picture of Robert Brenstein
    Mon, 7 May 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.
  • Picture of Tobias Reischmann
    Tue, 8 May 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,
1 2

Commenting temporarily disabled