mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-29108 Advanced grading - renaming DB field forminstanceid to instanceid
As a response to Sam's review (7.4)
This commit is contained in:
parent
71ab436aa9
commit
6f07a6a2ea
@ -107,7 +107,7 @@ class backup_gradingform_rubric_plugin extends backup_gradingform_plugin {
|
||||
// Set sources to populate the data
|
||||
|
||||
$filling->set_source_table('gradingform_rubric_fillings',
|
||||
array('forminstanceid' => backup::VAR_PARENTID));
|
||||
array('instanceid' => backup::VAR_PARENTID));
|
||||
|
||||
// no need to annotate ids or files yet (one day when remark field supports
|
||||
// embedded fileds, they must be annotated here)
|
||||
|
@ -105,7 +105,7 @@ class restore_gradingform_rubric_plugin extends restore_gradingform_plugin {
|
||||
global $DB;
|
||||
|
||||
$data = (object)$data;
|
||||
$data->forminstanceid = $this->get_new_parentid('grading_instance');
|
||||
$data->instanceid = $this->get_new_parentid('grading_instance');
|
||||
$data->criterionid = $this->get_mappingid('gradingform_rubric_criterion', $data->criterionid);
|
||||
$data->levelid = $this->get_mappingid('gradingform_rubric_level', $data->levelid);
|
||||
|
||||
|
@ -32,18 +32,18 @@
|
||||
</TABLE>
|
||||
<TABLE NAME="gradingform_rubric_fillings" COMMENT="Stores the data of how the rubric is filled by a particular rater" PREVIOUS="gradingform_rubric_levels">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="forminstanceid"/>
|
||||
<FIELD NAME="forminstanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The ID of the grading form instance" PREVIOUS="id" NEXT="criterionid"/>
|
||||
<FIELD NAME="criterionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The ID of the criterion (row) in the rubric" PREVIOUS="forminstanceid" NEXT="levelid"/>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="instanceid"/>
|
||||
<FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The ID of the grading form instance" PREVIOUS="id" NEXT="criterionid"/>
|
||||
<FIELD NAME="criterionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The ID of the criterion (row) in the rubric" PREVIOUS="instanceid" NEXT="levelid"/>
|
||||
<FIELD NAME="levelid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="If a particular level was selected during the assessment, its ID is stored here" PREVIOUS="criterionid" NEXT="remark"/>
|
||||
<FIELD NAME="remark" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Side note feedback regarding this particular criterion" PREVIOUS="levelid" NEXT="remarkformat"/>
|
||||
<FIELD NAME="remarkformat" TYPE="int" LENGTH="2" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="The format of the remark field" PREVIOUS="remark"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="fk_forminstanceid"/>
|
||||
<KEY NAME="fk_forminstanceid" TYPE="foreign" FIELDS="forminstanceid" REFTABLE="grading_instances" REFFIELDS="id" PREVIOUS="primary" NEXT="fk_criterionid"/>
|
||||
<KEY NAME="fk_criterionid" TYPE="foreign" FIELDS="criterionid" REFTABLE="gradingform_rubric_criteria" REFFIELDS="id" PREVIOUS="fk_forminstanceid" NEXT="uq_instance_criterion"/>
|
||||
<KEY NAME="uq_instance_criterion" TYPE="unique" FIELDS="forminstanceid, criterionid" PREVIOUS="fk_criterionid"/>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="fk_instanceid"/>
|
||||
<KEY NAME="fk_instanceid" TYPE="foreign" FIELDS="instanceid" REFTABLE="grading_instances" REFFIELDS="id" PREVIOUS="primary" NEXT="fk_criterionid"/>
|
||||
<KEY NAME="fk_criterionid" TYPE="foreign" FIELDS="criterionid" REFTABLE="gradingform_rubric_criteria" REFFIELDS="id" PREVIOUS="fk_instanceid" NEXT="uq_instance_criterion"/>
|
||||
<KEY NAME="uq_instance_criterion" TYPE="unique" FIELDS="instanceid, criterionid" PREVIOUS="fk_criterionid"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="ix_levelid" UNIQUE="false" FIELDS="levelid" COMMENT="levelid acts as a foreign key but null values are allowed"/>
|
||||
|
@ -472,7 +472,7 @@ class gradingform_rubric_controller extends gradingform_controller {
|
||||
// get the list of instances
|
||||
$instances = array_keys($DB->get_records('grading_instances', array('definitionid' => $this->definition->id), '', 'id'));
|
||||
// delete all fillings
|
||||
$DB->delete_records_list('gradingform_rubric_fillings', 'forminstanceid', $instances);
|
||||
$DB->delete_records_list('gradingform_rubric_fillings', 'instanceid', $instances);
|
||||
// delete instances
|
||||
$DB->delete_records_list('grading_instances', 'id', $instances);
|
||||
// get the list of criteria records
|
||||
@ -585,7 +585,7 @@ class gradingform_rubric_instance extends gradingform_instance {
|
||||
public function cancel() {
|
||||
global $DB;
|
||||
parent::cancel();
|
||||
$DB->delete_records('gradingform_rubric_fillings', array('forminstanceid' => $this->get_id()));
|
||||
$DB->delete_records('gradingform_rubric_fillings', array('instanceid' => $this->get_id()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -601,7 +601,7 @@ class gradingform_rubric_instance extends gradingform_instance {
|
||||
$instanceid = parent::copy($raterid, $itemid);
|
||||
$currentgrade = $this->get_rubric_filling();
|
||||
foreach ($currentgrade['criteria'] as $criterionid => $record) {
|
||||
$params = array('forminstanceid' => $instanceid, 'criterionid' => $criterionid,
|
||||
$params = array('instanceid' => $instanceid, 'criterionid' => $criterionid,
|
||||
'levelid' => $record['levelid'], 'remark' => $record['remark'], 'remarkformat' => $record['remarkformat']);
|
||||
$DB->insert_record('gradingform_rubric_fillings', $params);
|
||||
}
|
||||
@ -635,7 +635,7 @@ class gradingform_rubric_instance extends gradingform_instance {
|
||||
public function get_rubric_filling($force = false) {
|
||||
global $DB;
|
||||
if ($this->rubric === null || $force) {
|
||||
$records = $DB->get_records('gradingform_rubric_fillings', array('forminstanceid' => $this->get_id()));
|
||||
$records = $DB->get_records('gradingform_rubric_fillings', array('instanceid' => $this->get_id()));
|
||||
$this->rubric = array('criteria' => array());
|
||||
foreach ($records as $record) {
|
||||
$this->rubric['criteria'][$record->criterionid] = (array)$record;
|
||||
@ -657,7 +657,7 @@ class gradingform_rubric_instance extends gradingform_instance {
|
||||
parent::update($data);
|
||||
foreach ($data['criteria'] as $criterionid => $record) {
|
||||
if (!array_key_exists($criterionid, $currentgrade['criteria'])) {
|
||||
$newrecord = array('forminstanceid' => $this->get_id(), 'criterionid' => $criterionid,
|
||||
$newrecord = array('instanceid' => $this->get_id(), 'criterionid' => $criterionid,
|
||||
'levelid' => $record['levelid'], 'remarkformat' => FORMAT_MOODLE);
|
||||
if (isset($record['remark'])) {
|
||||
$newrecord['remark'] = $record['remark'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user