mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-70676 workshop: Allow empty grades.
This commit is contained in:
parent
95dd305cc6
commit
0420ec757a
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/workshop/db" VERSION="20180626" COMMENT="XMLDB file for Moodle mod/workshop"
|
||||
<XMLDB PATH="mod/workshop/db" VERSION="20210302" COMMENT="XMLDB file for Moodle mod/workshop"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -109,7 +109,7 @@
|
||||
<FIELD NAME="assessmentid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Part of which assessment this grade is of"/>
|
||||
<FIELD NAME="strategy" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="dimensionid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Foreign key. References dimension id in one of the grading strategy tables."/>
|
||||
<FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" SEQUENCE="false" DECIMALS="5" COMMENT="Given grade in the referenced assessment dimension."/>
|
||||
<FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="Given grade in the referenced assessment dimension."/>
|
||||
<FIELD NAME="peercomment" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Reviewer's comment to the grade value."/>
|
||||
<FIELD NAME="peercommentformat" TYPE="int" LENGTH="3" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="The format of peercomment field"/>
|
||||
</FIELDS>
|
||||
|
@ -51,5 +51,21 @@ function xmldb_workshop_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2021052501) {
|
||||
|
||||
$table = new xmldb_table('workshop_grades');
|
||||
$field = new xmldb_field('grade');
|
||||
|
||||
if ($dbman->field_exists($table, $field) && ($field->getNotNull() == XMLDB_NOTNULL)) {
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, false, false,
|
||||
null, null);
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021052501, 'workshop');
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -76,11 +76,13 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form {
|
||||
|
||||
// grade for this aspect
|
||||
$label = get_string('dimensiongradefor', 'workshopform_accumulative', $dimtitle);
|
||||
$options = make_grades_menu($fields->{'grade__idx_' . $i});
|
||||
$options = array('-1' => get_string('choosedots')) + $options;
|
||||
$mform->addElement('select', 'grade__idx_' . $i, $label, $options);
|
||||
$mform->addRule(array('grade__idx_' . $i, 'minusone') , get_string('mustchoosegrade', 'workshopform_accumulative'), 'compare', 'gt');
|
||||
|
||||
if ($fields->{'grade__idx_' . $i}) {
|
||||
$options = make_grades_menu($fields->{'grade__idx_' . $i});
|
||||
$options = array('-1' => get_string('choosedots')) + $options;
|
||||
$mform->addElement('select', 'grade__idx_' . $i, $label, $options);
|
||||
$mform->addRule(array('grade__idx_' . $i, 'minusone'),
|
||||
get_string('mustchoosegrade', 'workshopform_accumulative'), 'compare', 'gt');
|
||||
}
|
||||
// comment
|
||||
$label = get_string('dimensioncommentfor', 'workshopform_accumulative', $dimtitle);
|
||||
//$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0));
|
||||
|
@ -269,7 +269,9 @@ class workshop_accumulative_strategy implements workshop_strategy {
|
||||
$grade->assessmentid = $assessment->id;
|
||||
$grade->strategy = 'accumulative';
|
||||
$grade->dimensionid = $data->{'dimensionid__idx_' . $i};
|
||||
$grade->grade = $data->{'grade__idx_' . $i};
|
||||
if (isset($data->{'grade__idx_' . $i})) {
|
||||
$grade->grade = $data->{'grade__idx_' . $i};
|
||||
}
|
||||
$grade->peercomment = $data->{'peercomment__idx_' . $i};
|
||||
$grade->peercommentformat = FORMAT_MOODLE;
|
||||
if (empty($grade->id)) {
|
||||
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2021052500; // The current module version (YYYYMMDDXX)
|
||||
$plugin->version = 2021052501; // The current module version (YYYYMMDDXX).
|
||||
$plugin->requires = 2021052500; // Requires this Moodle version.
|
||||
$plugin->component = 'mod_workshop';
|
||||
|
Loading…
x
Reference in New Issue
Block a user