Moodle  2.2.1
http://www.collinsharper.com
testable_workshop_random_allocator Class Reference
Inheritance diagram for testable_workshop_random_allocator:
Collaboration diagram for testable_workshop_random_allocator:

Public Member Functions

 self_allocation ($authors=array(), $reviewers=array(), $assessments=array())
 get_author_ids ($newallocations)
 index_submissions_by_authors ($submissions)
 get_unique_allocations ($newallocations)
 get_unkept_assessments ($assessments, $newallocations, $keepselfassessments)
 convert_assessments_to_links ($assessments)
 get_element_with_lowest_workload ($workload)
 filter_current_assessments (&$newallocations, $assessments)

Detailed Description

Make protected methods we want to test public

Definition at line 36 of file testallocator.php.


Member Function Documentation

convert_assessments_to_links ( assessments)

Extracts the information about reviews from the authors' and reviewers' perspectives

Parameters:
array$assessmentsarray of assessments as returned by workshop::get_all_assessments()
Returns:
array of two arrays

Reimplemented from workshop_random_allocator.

Definition at line 52 of file testallocator.php.

filter_current_assessments ( &$  newallocations,
assessments 
)

Filter new allocations so that they do not contain an already existing assessment

Parameters:
mixed$newallocationsarray of ('reviewerid' => 'authorid') tuples
array$assessmentsarray of assessment records
Returns:
void

Reimplemented from workshop_random_allocator.

Definition at line 58 of file testallocator.php.

get_author_ids ( newallocations)

Extracts unique list of authors' IDs from the structure of new allocations

Parameters:
array$newallocationsof pairs 'reviewerid' => 'authorid'
Returns:
array of authorids

Reimplemented from workshop_random_allocator.

Definition at line 40 of file testallocator.php.

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
Returns:
mixed int|bool id of the selected element or false if it is impossible to choose

Reimplemented from workshop_random_allocator.

Definition at line 55 of file testallocator.php.

get_unique_allocations ( newallocations)

Removes duplicate allocations

Parameters:
mixed$newallocationsarray of 'reviewerid' => 'authorid' pairs
Returns:
array

Reimplemented from workshop_random_allocator.

Definition at line 46 of file testallocator.php.

get_unkept_assessments ( assessments,
newallocations,
keepselfassessments 
)

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$assessmentslist of current assessments
mixed$newallocationsarray of 'reviewerid' => 'authorid' pairs
bool$keepselfassessmentsdo not remove already allocated self assessments
Returns:
array of assessments ids to be removed

Reimplemented from workshop_random_allocator.

Definition at line 49 of file testallocator.php.

index_submissions_by_authors ( submissions)

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$submissionsarray indexed by submission id
Returns:
array indexed by author id

Reimplemented from workshop_random_allocator.

Definition at line 43 of file testallocator.php.

self_allocation ( authors = array(),
reviewers = array(),
assessments = array() 
)

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$authorsgrouped of {
See also:
workshop::get_potential_authors()}
Parameters:
array$reviewersgrouped by {
See also:
workshop::get_potential_reviewers()}
Parameters:
array$assessmentsas returned by {
See also:
workshop::get_all_assessments()}
Returns:
array of new allocations to be created, array of array(reviewerid => authorid)

Reimplemented from workshop_random_allocator.

Definition at line 37 of file testallocator.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations