"Number of errors" grading strategy logic.
More...
|
static | delete_instance ($workshopid) |
| Delete all data related to a given workshop module instance.
|
|
static | scale_used ($scaleid, $workshopid=null) |
| Is a given scale used by the instance of workshop?
|
|
|
number const | ADDDIMS = 2 |
| of dimensions to add
|
|
default const | MINDIMS = 3 |
| number of dimensions to show
|
|
|
array | $descriptionopts |
| options for dimension description fields
|
|
array | $dimensions = null |
| definition of the assessment form fields
|
|
array | $mappings = null |
| mapping of the number of errors to a grade
|
|
workshop | $workshop |
| the parent workshop instance
|
|
"Number of errors" grading strategy logic.
◆ __construct()
workshop_numerrors_strategy::__construct |
( |
workshop | $workshop | ) |
|
Constructor.
- Parameters
-
workshop | $workshop | The workshop instance record |
- Return values
-
◆ calculate_peer_grade()
workshop_numerrors_strategy::calculate_peer_grade |
( |
array | $grades | ) |
|
|
protected |
Calculates the aggregated grade given by the reviewer.
- Parameters
-
- Return values
-
float|null | Raw grade (0.00000 to 100.00000) for submission as suggested by the peer |
◆ delete_dimensions()
workshop_numerrors_strategy::delete_dimensions |
( |
array | $ids | ) |
|
|
protected |
Deletes dimensions and removes embedded media from its descriptions.
todo we may check that there are no assessments done using these dimensions and probably remove them
- Parameters
-
- Return values
-
◆ delete_instance()
static workshop_numerrors_strategy::delete_instance |
( |
| $workshopid | ) |
|
|
static |
◆ errors_to_grade()
workshop_numerrors_strategy::errors_to_grade |
( |
| $numerrors | ) |
|
|
protected |
Returns a grade 0.00000 to 100.00000 for the given number of errors.
This is where we use the mapping table defined by the teacher. If a grade for the given number of errors (negative assertions) is not defined, the most recently defined one is used. Example of the defined mapping: Number of errors | Grade 0 | 100% (always) 1 | - (not defined) 2 | 80% 3 | 60% 4 | - 5 | 30% 6 | 0% With this mapping, one error is mapped to 100% grade and 4 errors is mapped to 60%.
- Parameters
-
mixed | $numerrors | Number of errors |
- Return values
-
float | Raw grade (0.00000 to 100.00000) for the given number of negative assertions |
◆ form_ready()
workshop_numerrors_strategy::form_ready |
( |
| ) |
|
Has the assessment form been defined and is ready to be used by the reviewers?
- Return values
-
Implements workshop_strategy.
◆ get_assessment_form()
workshop_numerrors_strategy::get_assessment_form |
( |
moodle_url | $actionurl = null, |
|
|
| $mode = 'preview', |
|
|
stdclass | $assessment = null, |
|
|
| $editable = true, |
|
|
| $options = array() ) |
Factory method returning an instance of an assessment form.
- Parameters
-
moodle_url | $actionurl | URL of form handler, defaults to auto detect the current url |
string | $mode | Mode to open the form in: preview/assessment |
stdClass | $assessment | |
bool | $editable | |
array | $options | |
Implements workshop_strategy.
◆ get_assessments_recordset()
workshop_numerrors_strategy::get_assessments_recordset |
( |
| $restrict = null | ) |
|
◆ get_current_assessment_data()
workshop_numerrors_strategy::get_current_assessment_data |
( |
stdclass | $assessment | ) |
|
|
protected |
Returns the list of current grades filled by the reviewer.
- Parameters
-
stdClass | $assessment | Assessment record |
- Return values
-
array | of filtered records from the table workshop_grades |
◆ get_dimensions_info()
workshop_numerrors_strategy::get_dimensions_info |
( |
| ) |
|
◆ get_edit_strategy_form()
workshop_numerrors_strategy::get_edit_strategy_form |
( |
| $actionurl = null | ) |
|
Factory method returning an instance of an assessment form editor class.
- Parameters
-
$actionurl | URL of form handler, defaults to auto detect the current url |
Implements workshop_strategy.
◆ load_fields()
workshop_numerrors_strategy::load_fields |
( |
| ) |
|
|
protected |
Loads the fields of the assessment form currently used in this workshop.
- Return values
-
array | definition of assessment dimensions |
◆ load_mappings()
workshop_numerrors_strategy::load_mappings |
( |
| ) |
|
|
protected |
Loads the mappings of the number of errors to the grade.
- Return values
-
◆ prepare_database_fields()
workshop_numerrors_strategy::prepare_database_fields |
( |
stdclass | $raw | ) |
|
|
protected |
Prepares data returned by workshop_edit_numerrors_strategy_form so they can be saved into database.
It automatically adds some columns into every record. The sorting is done by the order of the returned array and starts with 1. Called internally from save_edit_strategy_form() only. Could be private but keeping protected for unit testing purposes.
- Parameters
-
stdClass | $raw | Raw data returned by mform |
- Return values
-
array | Array of objects to be inserted/updated in DB |
◆ prepare_form_fields()
workshop_numerrors_strategy::prepare_form_fields |
( |
array | $dims, |
|
|
array | $maps ) |
|
protected |
Prepares the database data to be used by the mform.
- Parameters
-
- Return values
-
array | Array of fields data to be used by the mform set_data |
◆ save_assessment()
workshop_numerrors_strategy::save_assessment |
( |
stdclass | $assessment, |
|
|
stdclass | $data ) |
Saves the filled assessment.
This method processes data submitted using the form returned by get_assessment_form()
- Parameters
-
stdClass | $assessment | Assessment being filled |
stdClass | $data | Raw data as returned by the assessment form |
- Return values
-
float|null | Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer |
Implements workshop_strategy.
◆ save_edit_strategy_form()
workshop_numerrors_strategy::save_edit_strategy_form |
( |
stdclass | $data | ) |
|
Save the assessment dimensions into database.
Saves data into the main strategy form table. If the record->id is null or zero, new record is created. If the record->id is not empty, the existing record is updated. Records with empty 'description' field are removed from database. The passed data object are the raw data returned by the get_data().
@uses $DB
- Parameters
-
stdClass | $data | Raw data returned by the dimension editor form |
- Return values
-
Implements workshop_strategy.
◆ scale_used()
static workshop_numerrors_strategy::scale_used |
( |
| $scaleid, |
|
|
| $workshopid = null ) |
|
static |
Is a given scale used by the instance of workshop?
This grading strategy does not use scales.
- Parameters
-
int | $scaleid | id of the scale to check |
int | null | $workshopid | id of workshop instance to check, checks all in case of null |
- Return values
-
Implements workshop_strategy.
◆ update_peer_grade()
workshop_numerrors_strategy::update_peer_grade |
( |
stdclass | $assessment | ) |
|
|
protected |
Aggregates the assessment form data and sets the grade for the submission given by the peer.
- Parameters
-
stdClass | $assessment | Assessment record |
- Return values
-
float|null | Raw grade (0.00000 to 100.00000) for submission as suggested by the peer |
The documentation for this class was generated from the following file:
- mod/workshop/form/numerrors/lib.php