Allocates the submissions randomly.
More...
|
const | MSG_SUCCESS = 1 |
| constants used to pass status messages between init() and ui()
|
|
|
| add_new_allocations (array $newallocations, array $dataauthors, array $datareviewers) |
| Creates new assessment records.
|
|
| convert_assessments_to_links ($assessments) |
| Extracts the information about reviews from the authors' and reviewers' perspectives.
|
|
| filter_current_assessments (&$newallocations, $assessments) |
| Filter new allocations so that they do not contain an already existing assessment.
|
|
| get_author_ids ($newallocations) |
| Extracts unique list of authors' IDs from the structure of new allocations.
|
|
| get_element_with_lowest_workload ($workload) |
| Selects an element with the lowest workload.
|
|
| get_unique_allocations ($newallocations) |
| Removes duplicate allocations.
|
|
| get_unkept_assessments ($assessments, $newallocations, $keepselfassessments) |
| Returns the list of assessments to remove.
|
|
| index_submissions_by_authors ($submissions) |
| Flips the structure of submission so it is indexed by authorid attribute.
|
|
| random_allocation ($authors, $reviewers, $assessments, $result, array $options) |
| Allocates submission reviews randomly.
|
|
| self_allocation ($authors=array(), $reviewers=array(), $assessments=array()) |
| Allocates submissions to their authors for review.
|
|
| shuffle_assoc (&$array) |
| Shuffle the order of array elements preserving the key=>values.
|
|
|
| $mform |
| mform with settings
|
|
| $workshop |
| workshop instance
|
|
Allocates the submissions randomly.
◆ __construct()
workshop_random_allocator::__construct |
( |
workshop | $workshop | ) |
|
- Parameters
-
workshop | $workshop | Workshop API object |
◆ add_new_allocations()
workshop_random_allocator::add_new_allocations |
( |
array | $newallocations, |
|
|
array | $dataauthors, |
|
|
array | $datareviewers ) |
|
protected |
Creates new assessment records.
- Parameters
-
array | $newallocations | pairs 'reviewerid' => 'authorid' |
array | $dataauthors | authors by group, group [0] contains all authors |
array | $datareviewers | reviewers by group, group [0] contains all reviewers |
- Return values
-
◆ available_numofreviews_list()
static workshop_random_allocator::available_numofreviews_list |
( |
| ) |
|
|
static |
Return an array of possible numbers of reviews to be done.
Should contain numbers 1, 2, 3, ... 10 and possibly others up to a reasonable value
- Return values
-
◆ convert_assessments_to_links()
workshop_random_allocator::convert_assessments_to_links |
( |
| $assessments | ) |
|
|
protected |
Extracts the information about reviews from the authors' and reviewers' perspectives.
- Parameters
-
- Return values
-
◆ delete_instance()
static workshop_random_allocator::delete_instance |
( |
| $workshopid | ) |
|
|
static |
Delete all data related to a given workshop module instance.
This plugin does not store any data.
- See also
- workshop_delete_instance()
- Parameters
-
int | $workshopid | id of the workshop module instance being deleted |
- Return values
-
Implements workshop_allocator.
◆ execute()
Executes the allocation based on the given settings.
- Parameters
-
◆ filter_current_assessments()
workshop_random_allocator::filter_current_assessments |
( |
& | $newallocations, |
|
|
| $assessments ) |
|
protected |
Filter new allocations so that they do not contain an already existing assessment.
- Parameters
-
mixed | $newallocations | array of ('reviewerid' => 'authorid') tuples |
array | $assessments | array of assessment records |
- Return values
-
◆ get_author_ids()
workshop_random_allocator::get_author_ids |
( |
| $newallocations | ) |
|
|
protected |
Extracts unique list of authors' IDs from the structure of new allocations.
- Parameters
-
array | $newallocations | of pairs 'reviewerid' => 'authorid' |
- Return values
-
◆ get_element_with_lowest_workload()
workshop_random_allocator::get_element_with_lowest_workload |
( |
| $workload | ) |
|
|
protected |
Selects an element with the lowest workload.
If there are more elements with the same workload, choose one of them randomly. This may be used to select a group or user.
- Parameters
-
array | $workload | [groupid] => (int)workload |
- Return values
-
mixed | int|bool id of the selected element or false if it is impossible to choose |
◆ get_unique_allocations()
workshop_random_allocator::get_unique_allocations |
( |
| $newallocations | ) |
|
|
protected |
Removes duplicate allocations.
- Parameters
-
mixed | $newallocations | array of 'reviewerid' => 'authorid' pairs |
- Return values
-
◆ get_unkept_assessments()
workshop_random_allocator::get_unkept_assessments |
( |
| $assessments, |
|
|
| $newallocations, |
|
|
| $keepselfassessments ) |
|
protected |
Returns the list of assessments to remove.
If user selects "removecurrentallocations", we should remove all current assessment records and insert new ones. But this would needlessly waste table ids. Instead, let us find only those assessments that have not been re-allocated in this run of allocation. So, the once-allocated submissions are kept with their original id.
- Parameters
-
array | $assessments | list of current assessments |
mixed | $newallocations | array of 'reviewerid' => 'authorid' pairs |
bool | $keepselfassessments | do not remove already allocated self assessments |
- Return values
-
array | of assessments ids to be removed |
◆ index_submissions_by_authors()
workshop_random_allocator::index_submissions_by_authors |
( |
| $submissions | ) |
|
|
protected |
Flips the structure of submission so it is indexed by authorid attribute.
It is the caller's responsibility to make sure the submissions are not teacher examples so no user is the author of more submissions.
- Parameters
-
string | $submissions | array indexed by submission id |
- Return values
-
array | indexed by author id |
◆ init()
workshop_random_allocator::init |
( |
| ) |
|
◆ random_allocation()
workshop_random_allocator::random_allocation |
( |
| $authors, |
|
|
| $reviewers, |
|
|
| $assessments, |
|
|
| $result, |
|
|
array | $options ) |
|
protected |
Allocates submission reviews randomly.
The algorithm of this function has been described at http://moodle.org/mod/forum/discuss.php?d=128473 Please see the PDF attached to the post before you study the implementation. The goal of the function is to connect each "circle" (circles are representing either authors or reviewers) with a required number of "squares" (the other type than circles are).
The passed $options array must provide keys: (int)numofreviews - number of reviews to be allocated to each circle (int)numper - what user type the circles represent. (bool)excludesamegroup - whether to prevent peer submissions from the same group in visible group mode
- Parameters
-
array | $authors | structure of grouped authors |
array | $reviewers | structure of grouped reviewers |
array | $assessments | currently assigned assessments to be kept |
workshop_allocation_result | $result | allocation result logger |
array | $options | allocation options |
- Return values
-
array | array of (reviewerid => authorid) pairs |
◆ self_allocation()
workshop_random_allocator::self_allocation |
( |
| $authors = array(), |
|
|
| $reviewers = array(), |
|
|
| $assessments = array() ) |
|
protected |
Allocates submissions to their authors for review.
If the submission has already been allocated, it is skipped. If the author is not found among reviewers, the submission is not assigned.
- Parameters
-
array | $authors | grouped of { |
- See also
- workshop\get_potential_authors()}
- Parameters
-
array | $reviewers | grouped by { |
- See also
- workshop\get_potential_reviewers()}
- Parameters
-
array | $assessments | as returned by { |
- See also
- workshop\get_all_assessments()}
- Return values
-
array | of new allocations to be created, array of array(reviewerid => authorid) |
◆ shuffle_assoc()
workshop_random_allocator::shuffle_assoc |
( |
& | $array | ) |
|
|
protected |
Shuffle the order of array elements preserving the key=>values.
- Parameters
-
array | $array | to be shuffled |
- Return values
-
◆ ui()
workshop_random_allocator::ui |
( |
| ) |
|
The documentation for this class was generated from the following file:
- mod/workshop/allocation/random/lib.php