mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-26633 workshop: Allow to randomly allocate more than 30 reviews
For classes with many students, there may be valid cases for having more than 30 reviews per submission / reviewer. The patch changes the type of the input field so that it can freely editable to any integer value.
This commit is contained in:
parent
e746dc75af
commit
78f9ea3b1c
@ -263,13 +263,17 @@ class workshop_random_allocator implements workshop_allocator {
|
||||
* @return array of integers
|
||||
*/
|
||||
public static function available_numofreviews_list() {
|
||||
$options = array();
|
||||
$options[30] = 30;
|
||||
$options[20] = 20;
|
||||
$options[15] = 15;
|
||||
for ($i = 10; $i >= 0; $i--) {
|
||||
|
||||
$options = [];
|
||||
|
||||
for ($i = 100; $i > 20; $i = $i - 10) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
|
||||
for ($i = 20; $i >= 0; $i--) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ class workshop_random_allocator_form extends moodleform {
|
||||
workshop_random_allocator_setting::NUMPER_REVIEWER => get_string('numperreviewer', 'workshopallocation_random')
|
||||
);
|
||||
$grpnumofreviews = array();
|
||||
$grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '',
|
||||
workshop_random_allocator::available_numofreviews_list());
|
||||
$grpnumofreviews[] = $mform->createElement('text', 'numofreviews', '', array('size' => 5, 'maxlength' => 20));
|
||||
$mform->setType('numofreviews', PARAM_INT);
|
||||
$mform->setDefault('numofreviews', $plugindefaults->numofreviews);
|
||||
$grpnumofreviews[] = $mform->createElement('select', 'numper', '', $options_numper);
|
||||
$mform->setDefault('numper', workshop_random_allocator_setting::NUMPER_SUBMISSION);
|
||||
@ -98,4 +98,22 @@ class workshop_random_allocator_form extends moodleform {
|
||||
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the allocation settings.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $files
|
||||
* @return array
|
||||
*/
|
||||
public function validation($data, $files): array {
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
if ($data['numofreviews'] < 0) {
|
||||
$errors['grpnumofreviews'] = get_string('invalidnum', 'core_error');
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user