fixed a few spelling problems and standardised stdClass

This commit is contained in:
Petr Skoda 2010-09-18 14:18:39 +00:00
parent 1c5765dd7a
commit 5924db724d
28 changed files with 151 additions and 151 deletions

View file

@ -55,7 +55,7 @@ interface workshop_allocator {
* *
* If a form is part of the UI, the caller should have called $PAGE->set_url(...) * If a form is part of the UI, the caller should have called $PAGE->set_url(...)
* *
* @param stdclass $wsoutput workshop module renderer can be used * @param stdClass $wsoutput workshop module renderer can be used
* @return string HTML code to be echoed * @return string HTML code to be echoed
*/ */
public function ui(); public function ui();

View file

@ -33,7 +33,7 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
/** /**
* Display the table of all current allocations and widgets to modify them * Display the table of all current allocations and widgets to modify them
* *
* @param stdclass $data to be displayed - see the top of the function for the list of needed properties * @param stdClass $data to be displayed - see the top of the function for the list of needed properties
* @return string html code * @return string html code
*/ */
public function display_allocations(stdclass $data) { public function display_allocations(stdclass $data) {

View file

@ -370,7 +370,7 @@ class workshop_random_allocator implements workshop_allocator {
* @param array $authors structure of grouped authors * @param array $authors structure of grouped authors
* @param resource $reviewers structure of grouped reviewers * @param resource $reviewers structure of grouped reviewers
* @param array $assessments currently assigned assessments to be kept * @param array $assessments currently assigned assessments to be kept
* @param mixed $numofreviews number of reviewes to be allocated to each circle * @param mixed $numofreviews number of reviews to be allocated to each circle
* @param mixed $numper what user type the circles represent * @param mixed $numper what user type the circles represent
* @param array $o reference to an array of log messages * @param array $o reference to an array of log messages
* @return array array of (reviewerid => authorid) pairs * @return array array of (reviewerid => authorid) pairs

View file

@ -166,7 +166,7 @@ $wsoutput = $PAGE->get_renderer('mod_workshop'); // workshop renderer
$submission = $workshop->get_submission_by_id($submission->id); // reload so can be passed to the renderer $submission = $workshop->get_submission_by_id($submission->id); // reload so can be passed to the renderer
echo $wsoutput->submission_full($submission, has_capability('mod/workshop:viewauthornames', $workshop->context)); echo $wsoutput->submission_full($submission, has_capability('mod/workshop:viewauthornames', $workshop->context));
// show instructions for assessing as thay may contain important information // show instructions for assessing as they may contain important information
// for evaluating the assessment // for evaluating the assessment
if (trim($workshop->instructreviewers)) { if (trim($workshop->instructreviewers)) {
$instructions = file_rewrite_pluginfile_urls($workshop->instructreviewers, 'pluginfile.php', $PAGE->context->id, $instructions = file_rewrite_pluginfile_urls($workshop->instructreviewers, 'pluginfile.php', $PAGE->context->id,

View file

@ -86,7 +86,7 @@ $capabilities = array(
), ),
// Ability to submit and referentialy assess the examples and to see all other // Ability to submit and referentially assess the examples and to see all other
// assessments of these examples // assessments of these examples
'mod/workshop:manageexamples' => array( 'mod/workshop:manageexamples' => array(
'captype' => 'write', 'captype' => 'write',
@ -181,7 +181,7 @@ $capabilities = array(
) )
), ),
// Ability to override grade for submission or the calcaluted grades for assessment // Ability to override grade for submission or the calculated grades for assessment
// and to run aggregation tasks that computes the total grade // and to run aggregation tasks that computes the total grade
'mod/workshop:overridegrades' => array( 'mod/workshop:overridegrades' => array(
'captype' => 'write', 'captype' => 'write',

View file

@ -58,7 +58,7 @@ class workshop_best_evaluation implements workshop_evaluation {
* This function relies on the grading strategy subplugin providing get_assessments_recordset() method. * This function relies on the grading strategy subplugin providing get_assessments_recordset() method.
* {@see self::process_assessments()} for the required structure of the recordset. * {@see self::process_assessments()} for the required structure of the recordset.
* *
* @param stdclass $settings The settings for this round of evaluation * @param stdClass $settings The settings for this round of evaluation
* @param null|int|array $restrict If null, update all reviewers, otherwise update just grades for the given reviewers(s) * @param null|int|array $restrict If null, update all reviewers, otherwise update just grades for the given reviewers(s)
* *
* @return void * @return void
@ -95,7 +95,7 @@ class workshop_best_evaluation implements workshop_evaluation {
if ($current->submissionid == $previous->submissionid) { if ($current->submissionid == $previous->submissionid) {
$batch[] = $current; $batch[] = $current;
} else { } else {
// process all the assessments of a sigle submission // process all the assessments of a single submission
$this->process_assessments($batch, $diminfo, $settings); $this->process_assessments($batch, $diminfo, $settings);
// start with a new batch to be processed // start with a new batch to be processed
$batch = array($current); $batch = array($current);
@ -146,7 +146,7 @@ class workshop_best_evaluation implements workshop_evaluation {
* *
* @param array $assessments of stdclass (->assessmentid ->assessmentweight ->reviewerid ->gradinggrade ->submissionid ->dimensionid ->grade) * @param array $assessments of stdclass (->assessmentid ->assessmentweight ->reviewerid ->gradinggrade ->submissionid ->dimensionid ->grade)
* @param array $diminfo of stdclass (->id ->weight ->max ->min) * @param array $diminfo of stdclass (->id ->weight ->max ->min)
* @param stdclass grading evaluation settings * @param stdClass grading evaluation settings
* @return void * @return void
*/ */
protected function process_assessments(array $assessments, array $diminfo, stdclass $settings) { protected function process_assessments(array $assessments, array $diminfo, stdclass $settings) {
@ -230,7 +230,7 @@ class workshop_best_evaluation implements workshop_evaluation {
protected function prepare_data_from_recordset($assessments) { protected function prepare_data_from_recordset($assessments) {
$data = array(); // to be returned $data = array(); // to be returned
foreach ($assessments as $a) { foreach ($assessments as $a) {
$id = $a->assessmentid; // just an abbrevation $id = $a->assessmentid; // just an abbreviation
if (!isset($data[$id])) { if (!isset($data[$id])) {
$data[$id] = new stdclass(); $data[$id] = new stdclass();
$data[$id]->assessmentid = $a->assessmentid; $data[$id]->assessmentid = $a->assessmentid;
@ -248,7 +248,7 @@ class workshop_best_evaluation implements workshop_evaluation {
/** /**
* Normalizes the dimension grades to the interval 0.00000 - 100.00000 * Normalizes the dimension grades to the interval 0.00000 - 100.00000
* *
* Note: this heavily relies on PHP5 way of handling references in array of stdclasses. Hopefuly * Note: this heavily relies on PHP5 way of handling references in array of stdclasses. Hopefully
* it will not change again soon. * it will not change again soon.
* *
* @param array $assessments of stdclass as returned by {@see self::prepare_data_from_recordset()} * @param array $assessments of stdclass as returned by {@see self::prepare_data_from_recordset()}
@ -276,7 +276,7 @@ class workshop_best_evaluation implements workshop_evaluation {
* The passed structure must be array of assessments objects with ->weight and ->dimgrades properties. * The passed structure must be array of assessments objects with ->weight and ->dimgrades properties.
* *
* @param array $assessments as prepared by {@link self::prepare_data_from_recordset()} * @param array $assessments as prepared by {@link self::prepare_data_from_recordset()}
* @return null|stdclass * @return null|stdClass
*/ */
protected function average_assessment(array $assessments) { protected function average_assessment(array $assessments) {
$sumdimgrades = array(); $sumdimgrades = array();
@ -332,7 +332,7 @@ class workshop_best_evaluation implements workshop_evaluation {
$sumweight = 0; $sumweight = 0;
foreach ($asids as $asid) { foreach ($asids as $asid) {
$x = $assessments[$asid]->dimgrades[$dimid]; // value (data point) $x = $assessments[$asid]->dimgrades[$dimid]; // value (data point)
$weight = $assessments[$asid]->weight; // the values's weight $weight = $assessments[$asid]->weight; // the values' weight
if ($weight == 0) { if ($weight == 0) {
continue; continue;
} }
@ -371,10 +371,10 @@ class workshop_best_evaluation implements workshop_evaluation {
* Returned value is rounded to 4 valid decimals to prevent some rounding issues - see the unit test * Returned value is rounded to 4 valid decimals to prevent some rounding issues - see the unit test
* for an example. * for an example.
* *
* @param stdclass $assessment the assessment being measured * @param stdClass $assessment the assessment being measured
* @param stdclass $referential assessment * @param stdClass $referential assessment
* @param array $diminfo of stdclass(->weight ->min ->max ->variance) indexed by dimension id * @param array $diminfo of stdclass(->weight ->min ->max ->variance) indexed by dimension id
* @param stdclass $settings * @param stdClass $settings
* @return float|null rounded to 4 valid decimals * @return float|null rounded to 4 valid decimals
*/ */
protected function assessments_distance(stdclass $assessment, stdclass $referential, array $diminfo, stdclass $settings) { protected function assessments_distance(stdclass $assessment, stdclass $referential, array $diminfo, stdclass $settings) {

View file

@ -103,7 +103,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
3 => (object)array('min' => 1, 'max' => 3), 3 => (object)array('min' => 1, 'max' => 3),
4 => (object)array('min' => 0, 'max' => 20), 4 => (object)array('min' => 0, 'max' => 20),
); );
// excersise SUT // exercise SUT
$norm = $this->evaluator->normalize_grades($assessments, $diminfo); $norm = $this->evaluator->normalize_grades($assessments, $diminfo);
// validate // validate
$this->assertIsA($norm, 'array'); $this->assertIsA($norm, 'array');
@ -126,7 +126,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
$diminfo = array( $diminfo = array(
3 => (object)array('min' => 100, 'max' => 100), 3 => (object)array('min' => 100, 'max' => 100),
); );
// excersise SUT // exercise SUT
$norm = $this->evaluator->normalize_grades($assessments, $diminfo); $norm = $this->evaluator->normalize_grades($assessments, $diminfo);
// validate // validate
$this->assertIsA($norm, 'array'); $this->assertIsA($norm, 'array');
@ -144,7 +144,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
'weight' => 1, 'weight' => 1,
'dimgrades' => array(1 => 0, 2 => 66.66667), 'dimgrades' => array(1 => 0, 2 => 66.66667),
); );
// excersise SUT // exercise SUT
$average = $this->evaluator->average_assessment($assessments); $average = $this->evaluator->average_assessment($assessments);
// validate // validate
$this->assertIsA($average->dimgrades, 'array'); $this->assertIsA($average->dimgrades, 'array');
@ -167,7 +167,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
'weight' => 1, 'weight' => 1,
'dimgrades' => array(3 => 11.0, 4 => 8.1, 5 => 88.0), 'dimgrades' => array(3 => 11.0, 4 => 8.1, 5 => 88.0),
); );
// excersise SUT // exercise SUT
$average = $this->evaluator->average_assessment($assessments); $average = $this->evaluator->average_assessment($assessments);
// validate // validate
$this->assertIsA($average->dimgrades, 'array'); $this->assertIsA($average->dimgrades, 'array');
@ -187,7 +187,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
'weight' => 0, 'weight' => 0,
'dimgrades' => array(3 => 11.0, 4 => 8.1, 5 => 88.0), 'dimgrades' => array(3 => 11.0, 4 => 8.1, 5 => 88.0),
); );
// excersise SUT // exercise SUT
$average = $this->evaluator->average_assessment($assessments); $average = $this->evaluator->average_assessment($assessments);
// validate // validate
$this->assertNull($average); $this->assertNull($average);
@ -215,7 +215,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
'weight' => 1, 'weight' => 1,
'dimgrades' => array(3 => 11, 4 => 9), 'dimgrades' => array(3 => 11, 4 => 9),
); );
// excersise SUT // exercise SUT
$variance = $this->evaluator->weighted_variance($assessments); $variance = $this->evaluator->weighted_variance($assessments);
// validate // validate
// dimension [3] have all the grades equal to 11 // dimension [3] have all the grades equal to 11
@ -233,7 +233,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
$assessment1 = (object)array('dimgrades' => array(3 => 15, 4 => 2)); $assessment1 = (object)array('dimgrades' => array(3 => 15, 4 => 2));
$assessment2 = (object)array('dimgrades' => array(3 => 15, 4 => 2)); $assessment2 = (object)array('dimgrades' => array(3 => 15, 4 => 2));
$settings = (object)array('comparison' => 5); $settings = (object)array('comparison' => 5);
// excersise SUT and validate // exercise SUT and validate
$this->assertEqual($this->evaluator->assessments_distance($assessment1, $assessment2, $diminfo, $settings), 0); $this->assertEqual($this->evaluator->assessments_distance($assessment1, $assessment2, $diminfo, $settings), 0);
} }
@ -248,7 +248,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
$assessment2 = (object)array('dimgrades' => array(3 => 75, 4 => 2)); $assessment2 = (object)array('dimgrades' => array(3 => 75, 4 => 2));
$referential = (object)array('dimgrades' => array(3 => 50, 4 => 3)); $referential = (object)array('dimgrades' => array(3 => 50, 4 => 3));
$settings = (object)array('comparison' => 5); $settings = (object)array('comparison' => 5);
// excersise SUT and validate // exercise SUT and validate
$this->assertEqual($this->evaluator->assessments_distance($assessment1, $referential, $diminfo, $settings), $this->assertEqual($this->evaluator->assessments_distance($assessment1, $referential, $diminfo, $settings),
$this->evaluator->assessments_distance($assessment2, $referential, $diminfo, $settings)); $this->evaluator->assessments_distance($assessment2, $referential, $diminfo, $settings));
*/ */
@ -261,7 +261,7 @@ class workshop_best_evaluation_test extends UnitTestCase {
$assessment2 = (object)array('dimgrades' => array(1 => 50, 2 => 33.33333)); $assessment2 = (object)array('dimgrades' => array(1 => 50, 2 => 33.33333));
$referential = (object)array('dimgrades' => array(1 => 25, 2 => 50)); $referential = (object)array('dimgrades' => array(1 => 25, 2 => 50));
$settings = (object)array('comparison' => 9); $settings = (object)array('comparison' => 9);
// excersise SUT and validate // exercise SUT and validate
$this->assertEqual($this->evaluator->assessments_distance($assessment1, $referential, $diminfo, $settings), $this->assertEqual($this->evaluator->assessments_distance($assessment1, $referential, $diminfo, $settings),
$this->evaluator->assessments_distance($assessment2, $referential, $diminfo, $settings)); $this->evaluator->assessments_distance($assessment2, $referential, $diminfo, $settings));

View file

@ -168,7 +168,7 @@ if ($edit) {
echo $OUTPUT->header(); echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($workshop->name), 2); echo $OUTPUT->heading(format_string($workshop->name), 2);
// show instructions for submitting as thay may contain some list of questions and we need to know them // show instructions for submitting as they may contain some list of questions and we need to know them
// while reading the submitted answer // while reading the submitted answer
if (trim($workshop->instructauthors)) { if (trim($workshop->instructauthors)) {
$instructions = file_rewrite_pluginfile_urls($workshop->instructauthors, 'pluginfile.php', $PAGE->context->id, $instructions = file_rewrite_pluginfile_urls($workshop->instructauthors, 'pluginfile.php', $PAGE->context->id,

View file

@ -89,7 +89,7 @@ function workshopform_accumulative_upgrade_legacy() {
/** /**
* Transforms a given record from workshop_elements_old into an object to be saved into workshopform_accumulative * Transforms a given record from workshop_elements_old into an object to be saved into workshopform_accumulative
* *
* @param stdclass $old legacy record from workshop_elements_old * @param stdClass $old legacy record from workshop_elements_old
* @param array $newscaleids mapping from old scale types into new standard ones * @param array $newscaleids mapping from old scale types into new standard ones
* @param int $newworkshopid id of the new workshop instance that replaced the previous one * @param int $newworkshopid id of the new workshop instance that replaced the previous one
* @return stdclass to be saved in workshopform_accumulative * @return stdclass to be saved in workshopform_accumulative
@ -132,9 +132,9 @@ function workshopform_accumulative_upgrade_element(stdclass $old, array $newscal
/** /**
* Transforms given grade record * Transforms given grade record
* *
* @param stdclass $old * @param stdClass $old
* @param int $newassessmentid * @param int $newassessmentid
* @param stdclass $newdimensioninfo * @param stdClass $newdimensioninfo
* @return stdclass * @return stdclass
*/ */
function workshopform_accumulative_upgrade_grade(stdclass $old, $newassessmentid, stdclass $newdimensioninfo) { function workshopform_accumulative_upgrade_grade(stdclass $old, $newassessmentid, stdclass $newdimensioninfo) {

View file

@ -142,7 +142,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
* The passed data object are the raw data returned by the get_data(). * The passed data object are the raw data returned by the get_data().
* *
* @uses $DB * @uses $DB
* @param stdclass $data Raw data returned by the dimension editor form * @param stdClass $data Raw data returned by the dimension editor form
* @return void * @return void
*/ */
public function save_edit_strategy_form(stdclass $data) { public function save_edit_strategy_form(stdclass $data) {
@ -184,7 +184,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
* *
* @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
* @param string $mode Mode to open the form in: preview/assessment * @param string $mode Mode to open the form in: preview/assessment
* @param stdclass $assessment The current assessment * @param stdClass $assessment The current assessment
* @param bool $editable * @param bool $editable
* @param array $options * @param array $options
*/ */
@ -237,8 +237,8 @@ class workshop_accumulative_strategy implements workshop_strategy {
* *
* This method processes data submitted using the form returned by {@link get_assessment_form()} * This method processes data submitted using the form returned by {@link get_assessment_form()}
* *
* @param stdclass $assessment Assessment being filled * @param stdClass $assessment Assessment being filled
* @param stdclass $data Raw data as returned by the assessment form * @param stdClass $data Raw data as returned by the assessment form
* @return float|null Raw grade (0.00000 to 100.00000) for submission as suggested by the peer * @return float|null Raw grade (0.00000 to 100.00000) for submission as suggested by the peer
*/ */
public function save_assessment(stdclass $assessment, stdclass $data) { public function save_assessment(stdclass $assessment, stdclass $data) {
@ -439,7 +439,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
* Called internally from {@link save_edit_strategy_form()} only. Could be private but * Called internally from {@link save_edit_strategy_form()} only. Could be private but
* keeping protected for unit testing purposes. * keeping protected for unit testing purposes.
* *
* @param stdclass $raw Raw data returned by mform * @param stdClass $raw Raw data returned by mform
* @return array Array of objects to be inserted/updated in DB * @return array Array of objects to be inserted/updated in DB
*/ */
protected function prepare_database_fields(stdclass $raw) { protected function prepare_database_fields(stdclass $raw) {
@ -463,7 +463,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
/** /**
* Returns the list of current grades filled by the reviewer indexed by dimensionid * Returns the list of current grades filled by the reviewer indexed by dimensionid
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return array [int dimensionid] => stdclass workshop_grades record * @return array [int dimensionid] => stdclass workshop_grades record
*/ */
protected function get_current_assessment_data(stdclass $assessment) { protected function get_current_assessment_data(stdclass $assessment) {
@ -486,7 +486,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
/** /**
* Aggregates the assessment form data and sets the grade for the submission given by the peer * Aggregates the assessment form data and sets the grade for the submission given by the peer
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer * @return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer
*/ */
protected function update_peer_grade(stdclass $assessment) { protected function update_peer_grade(stdclass $assessment) {

View file

@ -87,7 +87,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
// fixture set-up // fixture set-up
$this->strategy->dimensions = array(); $this->strategy->dimensions = array();
$grades = array(); $grades = array();
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertNull($suggested); $this->assertNull($suggested);
@ -97,7 +97,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
// fixture set-up // fixture set-up
$this->strategy->dimensions[1003] = (object)array('grade' => '20', 'weight' => '1'); $this->strategy->dimensions[1003] = (object)array('grade' => '20', 'weight' => '1');
$grades[] = (object)array('dimensionid' => 1003, 'grade' => '5.00000'); $grades[] = (object)array('dimensionid' => 1003, 'grade' => '5.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual(grade_floatval(5/20 * 100), $suggested); $this->assertEqual(grade_floatval(5/20 * 100), $suggested);
@ -108,7 +108,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$this->strategy->dimensions[1003] = (object)array('grade' => '20', 'weight' => '-1'); $this->strategy->dimensions[1003] = (object)array('grade' => '20', 'weight' => '-1');
$grades[] = (object)array('dimensionid' => 1003, 'grade' => '20'); $grades[] = (object)array('dimensionid' => 1003, 'grade' => '20');
$this->expectException('coding_exception'); $this->expectException('coding_exception');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
} }
@ -116,7 +116,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
// fixture set-up // fixture set-up
$this->strategy->dimensions[1003] = (object)array('grade' => '20', 'weight' => '3'); $this->strategy->dimensions[1003] = (object)array('grade' => '20', 'weight' => '3');
$grades[] = (object)array('dimensionid' => '1003', 'grade' => '5'); $grades[] = (object)array('dimensionid' => '1003', 'grade' => '5');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual(grade_floatval(5/20 * 100), $suggested); $this->assertEqual(grade_floatval(5/20 * 100), $suggested);
@ -132,7 +132,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 1004, 'grade' => '87.00000'); $grades[] = (object)array('dimensionid' => 1004, 'grade' => '87.00000');
$grades[] = (object)array('dimensionid' => 1005, 'grade' => '10.00000'); $grades[] = (object)array('dimensionid' => 1005, 'grade' => '10.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
@ -149,7 +149,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 1004, 'grade' => '66.00000'); $grades[] = (object)array('dimensionid' => 1004, 'grade' => '66.00000');
$grades[] = (object)array('dimensionid' => 1005, 'grade' => '4.00000'); $grades[] = (object)array('dimensionid' => 1005, 'grade' => '4.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
@ -166,7 +166,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$DB->expectOnce('get_field', array('scale', 'scale', array('id' => 10), MUST_EXIST)); $DB->expectOnce('get_field', array('scale', 'scale', array('id' => 10), MUST_EXIST));
$DB->setReturnValue('get_field', $mockscale); $DB->setReturnValue('get_field', $mockscale);
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
@ -181,7 +181,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 1008, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 1008, 'grade' => '1.00000');
$DB->expectNever('get_field', array('scale', 'scale', array('id' => 10), MUST_EXIST)); // cached $DB->expectNever('get_field', array('scale', 'scale', array('id' => 10), MUST_EXIST)); // cached
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
@ -207,7 +207,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$DB->expectAt(1, 'get_field', array('scale', 'scale', array('id' => 17), MUST_EXIST)); $DB->expectAt(1, 'get_field', array('scale', 'scale', array('id' => 17), MUST_EXIST));
$DB->setReturnValueAt(1, 'get_field', $mockscale17); $DB->setReturnValueAt(1, 'get_field', $mockscale17);
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
@ -224,7 +224,7 @@ class workshop_accumulative_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 1012, 'grade' => '4.00000'); // exceeds the number of scale items $grades[] = (object)array('dimensionid' => 1012, 'grade' => '4.00000'); // exceeds the number of scale items
$this->expectException('coding_exception'); $this->expectException('coding_exception');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
} }
} }

View file

@ -87,7 +87,7 @@ class workshop_assessment_form extends moodleform {
/** /**
* Add any strategy specific form fields. * Add any strategy specific form fields.
* *
* @param stdclass $mform the form being built. * @param stdClass $mform the form being built.
*/ */
protected function definition_inner(&$mform) { protected function definition_inner(&$mform) {
// By default, do nothing. // By default, do nothing.

View file

@ -86,7 +86,7 @@ function workshopform_comments_upgrade_legacy() {
/** /**
* Transforms a given record from workshop_elements_old into an object to be saved into workshopform_comments * Transforms a given record from workshop_elements_old into an object to be saved into workshopform_comments
* *
* @param stdclass $old legacy record from workshop_elements_old * @param stdClass $old legacy record from workshop_elements_old
* @param int $newworkshopid id of the new workshop instance that replaced the previous one * @param int $newworkshopid id of the new workshop instance that replaced the previous one
* @return stdclass to be saved in workshopform_comments * @return stdclass to be saved in workshopform_comments
*/ */
@ -102,9 +102,9 @@ function workshopform_comments_upgrade_element(stdclass $old, $newworkshopid) {
/** /**
* Transforms given grade record * Transforms given grade record
* *
* @param stdclass $old * @param stdClass $old
* @param int $newassessmentid * @param int $newassessmentid
* @param stdclass $newdimensioninfo * @param stdClass $newdimensioninfo
* @return stdclass * @return stdclass
*/ */
function workshopform_comments_upgrade_grade(stdclass $old, $newassessmentid, stdclass $newdimensioninfo) { function workshopform_comments_upgrade_grade(stdclass $old, $newassessmentid, stdclass $newdimensioninfo) {

View file

@ -115,7 +115,7 @@ class workshop_comments_strategy implements workshop_strategy {
$norepeats += self::ADDDIMS; $norepeats += self::ADDDIMS;
} }
// prepare the embeded files // prepare the embedded files
for ($i = 0; $i < $nodimensions; $i++) { for ($i = 0; $i < $nodimensions; $i++) {
// prepare all editor elements // prepare all editor elements
$fields = file_prepare_standard_editor($fields, 'description__idx_'.$i, $this->descriptionopts, $fields = file_prepare_standard_editor($fields, 'description__idx_'.$i, $this->descriptionopts,
@ -142,7 +142,7 @@ class workshop_comments_strategy implements workshop_strategy {
* The passed data object are the raw data returned by the get_data(). * The passed data object are the raw data returned by the get_data().
* *
* @uses $DB * @uses $DB
* @param stdclass $data Raw data returned by the dimension editor form * @param stdClass $data Raw data returned by the dimension editor form
* @return void * @return void
*/ */
public function save_edit_strategy_form(stdclass $data) { public function save_edit_strategy_form(stdclass $data) {
@ -171,7 +171,7 @@ class workshop_comments_strategy implements workshop_strategy {
// exiting field // exiting field
$DB->update_record('workshopform_comments', $record); $DB->update_record('workshopform_comments', $record);
} }
// re-save with correct path to embeded media files // re-save with correct path to embedded media files
$record = file_postupdate_standard_editor($record, 'description', $this->descriptionopts, $record = file_postupdate_standard_editor($record, 'description', $this->descriptionopts,
$PAGE->context, 'workshopform_comments', 'description', $record->id); $PAGE->context, 'workshopform_comments', 'description', $record->id);
$DB->update_record('workshopform_comments', $record); $DB->update_record('workshopform_comments', $record);
@ -184,7 +184,7 @@ class workshop_comments_strategy implements workshop_strategy {
* *
* @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
* @param string $mode Mode to open the form in: preview/assessment * @param string $mode Mode to open the form in: preview/assessment
* @param stdclass $assessment The current assessment * @param stdClass $assessment The current assessment
* @param bool $editable * @param bool $editable
* @param array $options * @param array $options
*/ */
@ -197,7 +197,7 @@ class workshop_comments_strategy implements workshop_strategy {
$fields = $this->prepare_form_fields($this->dimensions); $fields = $this->prepare_form_fields($this->dimensions);
$nodimensions = count($this->dimensions); $nodimensions = count($this->dimensions);
// rewrite URLs to the embeded files // rewrite URLs to the embedded files
for ($i = 0; $i < $nodimensions; $i++) { for ($i = 0; $i < $nodimensions; $i++) {
$fields->{'description__idx_'.$i} = file_rewrite_pluginfile_urls($fields->{'description__idx_'.$i}, $fields->{'description__idx_'.$i} = file_rewrite_pluginfile_urls($fields->{'description__idx_'.$i},
'pluginfile.php', $PAGE->context->id, 'workshopform_comments', 'description', $fields->{'dimensionid__idx_'.$i}); 'pluginfile.php', $PAGE->context->id, 'workshopform_comments', 'description', $fields->{'dimensionid__idx_'.$i});
@ -236,8 +236,8 @@ class workshop_comments_strategy implements workshop_strategy {
* *
* This method processes data submitted using the form returned by {@link get_assessment_form()} * This method processes data submitted using the form returned by {@link get_assessment_form()}
* *
* @param stdclass $assessment Assessment being filled * @param stdClass $assessment Assessment being filled
* @param stdclass $data Raw data as returned by the assessment form * @param stdClass $data Raw data as returned by the assessment form
* @return float|null Constant raw grade 100.00000 for submission as suggested by the peer * @return float|null Constant raw grade 100.00000 for submission as suggested by the peer
*/ */
public function save_assessment(stdclass $assessment, stdclass $data) { public function save_assessment(stdclass $assessment, stdclass $data) {
@ -415,7 +415,7 @@ class workshop_comments_strategy implements workshop_strategy {
* Called internally from {@link save_edit_strategy_form()} only. Could be private but * Called internally from {@link save_edit_strategy_form()} only. Could be private but
* keeping protected for unit testing purposes. * keeping protected for unit testing purposes.
* *
* @param stdclass $raw Raw data returned by mform * @param stdClass $raw Raw data returned by mform
* @return array Array of objects to be inserted/updated in DB * @return array Array of objects to be inserted/updated in DB
*/ */
protected function prepare_database_fields(stdclass $raw) { protected function prepare_database_fields(stdclass $raw) {
@ -437,7 +437,7 @@ class workshop_comments_strategy implements workshop_strategy {
/** /**
* Returns the list of current grades filled by the reviewer indexed by dimensionid * Returns the list of current grades filled by the reviewer indexed by dimensionid
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return array [int dimensionid] => stdclass workshop_grades record * @return array [int dimensionid] => stdclass workshop_grades record
*/ */
protected function get_current_assessment_data(stdclass $assessment) { protected function get_current_assessment_data(stdclass $assessment) {

View file

@ -84,7 +84,7 @@ class workshop_edit_strategy_form extends moodleform {
/** /**
* Add any strategy specific form fields. * Add any strategy specific form fields.
* *
* @param stdclass $mform the form being built. * @param stdClass $mform the form being built.
*/ */
protected function definition_inner(&$mform) { protected function definition_inner(&$mform) {
// By default, do nothing. // By default, do nothing.

View file

@ -45,7 +45,7 @@ interface workshop_strategy {
* to be evaluated. Each dimension consists of a set of form fields. Strategy-specific information * to be evaluated. Each dimension consists of a set of form fields. Strategy-specific information
* are saved in workshopform_{strategyname} tables. * are saved in workshopform_{strategyname} tables.
* *
* @param stdclass $data Raw data as returned by the form editor * @param stdClass $data Raw data as returned by the form editor
* @return void * @return void
*/ */
public function save_edit_strategy_form(stdclass $data); public function save_edit_strategy_form(stdclass $data);
@ -55,7 +55,7 @@ interface workshop_strategy {
* *
* @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
* @param string $mode Mode to open the form in: preview|assessment * @param string $mode Mode to open the form in: preview|assessment
* @param stdclass $assessment If opening in the assessment mode, the current assessment record * @param stdClass $assessment If opening in the assessment mode, the current assessment record
* @param bool $editable Shall the form be opened as editable (true) or read-only (false) * @param bool $editable Shall the form be opened as editable (true) or read-only (false)
* @param array $options More assessment form options, editableweight implemented only now * @param array $options More assessment form options, editableweight implemented only now
*/ */
@ -68,8 +68,8 @@ interface workshop_strategy {
* The returned grade should be rounded to 5 decimals as with round($grade, 5). * The returned grade should be rounded to 5 decimals as with round($grade, 5).
* *
* @see grade_floatval() * @see grade_floatval()
* @param stdclass $assessment Assessment being filled * @param stdClass $assessment Assessment being filled
* @param stdclass $data Raw data as returned by the assessment form * @param stdClass $data Raw data as returned by the assessment form
* @return float|null Raw percentual grade (0.00000 to 100.00000) for submission * @return float|null Raw percentual grade (0.00000 to 100.00000) for submission
* as suggested by the peer or null if impossible to count * as suggested by the peer or null if impossible to count
*/ */

View file

@ -116,7 +116,7 @@ function workshopform_numerrors_upgrade_legacy() {
/** /**
* Transforms a given record from workshop_elements_old into an object to be saved into workshopform_numerrors * Transforms a given record from workshop_elements_old into an object to be saved into workshopform_numerrors
* *
* @param stdclass $old legacy record from workshop_elements_old * @param stdClass $old legacy record from workshop_elements_old
* @param int $newworkshopid id of the new workshop instance that replaced the previous one * @param int $newworkshopid id of the new workshop instance that replaced the previous one
* @return stdclass to be saved in workshopform_numerrors * @return stdclass to be saved in workshopform_numerrors
*/ */
@ -148,9 +148,9 @@ function workshopform_numerrors_upgrade_element(stdclass $old, $newworkshopid) {
/** /**
* Transforms given grade record * Transforms given grade record
* *
* @param stdclass $old * @param stdClass $old
* @param int $newassessmentid * @param int $newassessmentid
* @param stdclass $newdimensioninfo * @param stdClass $newdimensioninfo
* @return stdclass * @return stdclass
*/ */
function workshopform_numerrors_upgrade_grade(stdclass $old, $newassessmentid, stdclass $newdimensioninfo) { function workshopform_numerrors_upgrade_grade(stdclass $old, $newassessmentid, stdclass $newdimensioninfo) {

View file

@ -147,7 +147,7 @@ class workshop_numerrors_strategy implements workshop_strategy {
* The passed data object are the raw data returned by the get_data(). * The passed data object are the raw data returned by the get_data().
* *
* @uses $DB * @uses $DB
* @param stdclass $data Raw data returned by the dimension editor form * @param stdClass $data Raw data returned by the dimension editor form
* @return void * @return void
*/ */
public function save_edit_strategy_form(stdclass $data) { public function save_edit_strategy_form(stdclass $data) {
@ -219,7 +219,7 @@ class workshop_numerrors_strategy implements workshop_strategy {
* *
* @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
* @param string $mode Mode to open the form in: preview/assessment * @param string $mode Mode to open the form in: preview/assessment
* @param stdclass $assessment * @param stdClass $assessment
* @param bool $editable * @param bool $editable
* @param array $options * @param array $options
*/ */
@ -272,8 +272,8 @@ class workshop_numerrors_strategy implements workshop_strategy {
* *
* This method processes data submitted using the form returned by {@link get_assessment_form()} * This method processes data submitted using the form returned by {@link get_assessment_form()}
* *
* @param stdclass $assessment Assessment being filled * @param stdClass $assessment Assessment being filled
* @param stdclass $data Raw data as returned by the assessment form * @param stdClass $data Raw data as returned by the assessment form
* @return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer * @return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer
*/ */
public function save_assessment(stdclass $assessment, stdclass $data) { public function save_assessment(stdclass $assessment, stdclass $data) {
@ -473,7 +473,7 @@ class workshop_numerrors_strategy implements workshop_strategy {
* Called internally from {@link save_edit_strategy_form()} only. Could be private but * Called internally from {@link save_edit_strategy_form()} only. Could be private but
* keeping protected for unit testing purposes. * keeping protected for unit testing purposes.
* *
* @param stdclass $raw Raw data returned by mform * @param stdClass $raw Raw data returned by mform
* @return array Array of objects to be inserted/updated in DB * @return array Array of objects to be inserted/updated in DB
*/ */
protected function prepare_database_fields(stdclass $raw) { protected function prepare_database_fields(stdclass $raw) {
@ -510,7 +510,7 @@ class workshop_numerrors_strategy implements workshop_strategy {
/** /**
* Returns the list of current grades filled by the reviewer * Returns the list of current grades filled by the reviewer
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return array of filtered records from the table workshop_grades * @return array of filtered records from the table workshop_grades
*/ */
protected function get_current_assessment_data(stdclass $assessment) { protected function get_current_assessment_data(stdclass $assessment) {
@ -533,7 +533,7 @@ class workshop_numerrors_strategy implements workshop_strategy {
/** /**
* Aggregates the assessment form data and sets the grade for the submission given by the peer * Aggregates the assessment form data and sets the grade for the submission given by the peer
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return float|null Raw grade (0.00000 to 100.00000) for submission as suggested by the peer * @return float|null Raw grade (0.00000 to 100.00000) for submission as suggested by the peer
*/ */
protected function update_peer_grade(stdclass $assessment) { protected function update_peer_grade(stdclass $assessment) {

View file

@ -91,7 +91,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$this->strategy->dimensions = array(); $this->strategy->dimensions = array();
$this->strategy->mappings = array(); $this->strategy->mappings = array();
$grades = array(); $grades = array();
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertNull($suggested); $this->assertNull($suggested);
@ -108,7 +108,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 108, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 108, 'grade' => '1.00000');
$grades[] = (object)array('dimensionid' => 111, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '1.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '1.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 100.00000); $this->assertEqual($suggested, 100.00000);
@ -131,7 +131,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '1.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 80.00000); $this->assertEqual($suggested, 80.00000);
@ -155,7 +155,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 10.00000); $this->assertEqual($suggested, 10.00000);
@ -179,7 +179,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 0.00000); $this->assertEqual($suggested, 0.00000);
@ -203,7 +203,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 111, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '1.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 33.00000); $this->assertEqual($suggested, 33.00000);
@ -227,7 +227,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '1.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '1.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 100.00000); $this->assertEqual($suggested, 100.00000);
@ -255,7 +255,7 @@ class workshop_numerrors_strategy_test extends UnitTestCase {
$grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 111, 'grade' => '0.00000');
$grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000'); $grades[] = (object)array('dimensionid' => 109, 'grade' => '0.00000');
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual($suggested, 5.00000); $this->assertEqual($suggested, 5.00000);

View file

@ -87,7 +87,7 @@ class backup_workshopform_rubric_subplugin extends backup_subplugin {
/** /**
* Returns the structure of dimension grades * Returns the structure of dimension grades
* *
* @param string forst parameter of {@link backup_nested_element} constructor * @param string first parameter of {@link backup_nested_element} constructor
*/ */
private function dimension_grades_structure($elementname) { private function dimension_grades_structure($elementname) {

View file

@ -229,7 +229,7 @@ function workshopform_rubric_upgrade_legacy_rubric() {
* *
* This is used during Criterion 1.9 -> Rubric 2.0 conversion * This is used during Criterion 1.9 -> Rubric 2.0 conversion
* *
* @param stdclass $old legacy record from workshop_elements_old * @param stdClass $old legacy record from workshop_elements_old
* @param int $newdimensionid id of the new workshopform_rubric dimension record to be linked to * @param int $newdimensionid id of the new workshopform_rubric dimension record to be linked to
* @return stdclass to be saved in workshopform_rubric_levels * @return stdclass to be saved in workshopform_rubric_levels
*/ */
@ -247,7 +247,7 @@ function workshopform_rubric_upgrade_criterion_level(stdclass $old, $newdimensio
* *
* This is used during Rubric 1.9 -> Rubric 2.0 conversion * This is used during Rubric 1.9 -> Rubric 2.0 conversion
* *
* @param stdclass $old legacy record from joined workshop_elements_old + workshop_rubrics_old * @param stdClass $old legacy record from joined workshop_elements_old + workshop_rubrics_old
* @param int $newdimensionid id of the new workshopform_rubric dimension record to be linked to * @param int $newdimensionid id of the new workshopform_rubric dimension record to be linked to
* @return stdclass to be saved in workshopform_rubric_levels * @return stdclass to be saved in workshopform_rubric_levels
*/ */

View file

@ -152,7 +152,7 @@ class workshop_rubric_strategy implements workshop_strategy {
* The passed data object are the raw data returned by the get_data(). * The passed data object are the raw data returned by the get_data().
* *
* @uses $DB * @uses $DB
* @param stdclass $data Raw data returned by the dimension editor form * @param stdClass $data Raw data returned by the dimension editor form
* @return void * @return void
*/ */
public function save_edit_strategy_form(stdclass $data) { public function save_edit_strategy_form(stdclass $data) {
@ -225,7 +225,7 @@ class workshop_rubric_strategy implements workshop_strategy {
* *
* @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
* @param string $mode Mode to open the form in: preview/assessment/readonly * @param string $mode Mode to open the form in: preview/assessment/readonly
* @param stdclass $assessment The current assessment * @param stdClass $assessment The current assessment
* @param bool $editable * @param bool $editable
* @param array $options * @param array $options
*/ */
@ -288,8 +288,8 @@ class workshop_rubric_strategy implements workshop_strategy {
* *
* This method processes data submitted using the form returned by {@link get_assessment_form()} * This method processes data submitted using the form returned by {@link get_assessment_form()}
* *
* @param stdclass $assessment Assessment being filled * @param stdClass $assessment Assessment being filled
* @param stdclass $data Raw data as returned by the assessment form * @param stdClass $data Raw data as returned by the assessment form
* @return float|null Raw grade (0.00000 to 100.00000) for submission as suggested by the peer * @return float|null Raw grade (0.00000 to 100.00000) for submission as suggested by the peer
*/ */
public function save_assessment(stdclass $assessment, stdclass $data) { public function save_assessment(stdclass $assessment, stdclass $data) {
@ -513,7 +513,7 @@ class workshop_rubric_strategy implements workshop_strategy {
* Called internally from {@link save_edit_strategy_form()} only. Could be private but * Called internally from {@link save_edit_strategy_form()} only. Could be private but
* keeping protected for unit testing purposes. * keeping protected for unit testing purposes.
* *
* @param stdclass $raw Raw data returned by mform * @param stdClass $raw Raw data returned by mform
* @return array Array of objects to be inserted/updated in DB * @return array Array of objects to be inserted/updated in DB
*/ */
protected function prepare_database_fields(stdclass $raw) { protected function prepare_database_fields(stdclass $raw) {
@ -546,7 +546,7 @@ class workshop_rubric_strategy implements workshop_strategy {
/** /**
* Returns the list of current grades filled by the reviewer indexed by dimensionid * Returns the list of current grades filled by the reviewer indexed by dimensionid
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return array [int dimensionid] => stdclass workshop_grades record * @return array [int dimensionid] => stdclass workshop_grades record
*/ */
protected function get_current_assessment_data(stdclass $assessment) { protected function get_current_assessment_data(stdclass $assessment) {
@ -569,7 +569,7 @@ class workshop_rubric_strategy implements workshop_strategy {
/** /**
* Aggregates the assessment form data and sets the grade for the submission given by the peer * Aggregates the assessment form data and sets the grade for the submission given by the peer
* *
* @param stdclass $assessment Assessment record * @param stdClass $assessment Assessment record
* @return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer * @return float|null Raw grade (from 0.00000 to 100.00000) for submission as suggested by the peer
*/ */
protected function update_peer_grade(stdclass $assessment) { protected function update_peer_grade(stdclass $assessment) {

View file

@ -114,7 +114,7 @@ class workshop_rubric_strategy_test extends UnitTestCase {
public function test_calculate_peer_grade_null_grade() { public function test_calculate_peer_grade_null_grade() {
// fixture set-up // fixture set-up
$grades = array(); $grades = array();
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertNull($suggested); $this->assertNull($suggested);
@ -125,7 +125,7 @@ class workshop_rubric_strategy_test extends UnitTestCase {
$grades[6] = (object)array('dimensionid' => 6, 'grade' => 0); $grades[6] = (object)array('dimensionid' => 6, 'grade' => 0);
$grades[8] = (object)array('dimensionid' => 8, 'grade' => 0); $grades[8] = (object)array('dimensionid' => 8, 'grade' => 0);
$grades[10] = (object)array('dimensionid' => 10, 'grade' => 10); $grades[10] = (object)array('dimensionid' => 10, 'grade' => 10);
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual(grade_floatval($suggested), 0.00000); $this->assertEqual(grade_floatval($suggested), 0.00000);
@ -136,7 +136,7 @@ class workshop_rubric_strategy_test extends UnitTestCase {
$grades[6] = (object)array('dimensionid' => 6, 'grade' => 8); $grades[6] = (object)array('dimensionid' => 6, 'grade' => 8);
$grades[8] = (object)array('dimensionid' => 8, 'grade' => 3); $grades[8] = (object)array('dimensionid' => 8, 'grade' => 3);
$grades[10] = (object)array('dimensionid' => 10, 'grade' => 40); $grades[10] = (object)array('dimensionid' => 10, 'grade' => 40);
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
$this->assertEqual(grade_floatval($suggested), 100.00000); $this->assertEqual(grade_floatval($suggested), 100.00000);
@ -147,7 +147,7 @@ class workshop_rubric_strategy_test extends UnitTestCase {
$grades[6] = (object)array('dimensionid' => 6, 'grade' => 2); $grades[6] = (object)array('dimensionid' => 6, 'grade' => 2);
$grades[8] = (object)array('dimensionid' => 8, 'grade' => 2); $grades[8] = (object)array('dimensionid' => 8, 'grade' => 2);
$grades[10] = (object)array('dimensionid' => 10, 'grade' => 30); $grades[10] = (object)array('dimensionid' => 10, 'grade' => 30);
// excercise SUT // exercise SUT
$suggested = $this->strategy->calculate_peer_grade($grades); $suggested = $this->strategy->calculate_peer_grade($grades);
// validate // validate
// minimal rubric score is 10, maximal is 51. We have 34 here // minimal rubric score is 10, maximal is 51. We have 34 here

View file

@ -60,7 +60,7 @@ function workshop_supports($feature) {
* will save a new instance and return the id number * will save a new instance and return the id number
* of the new instance. * of the new instance.
* *
* @param stdclass $workshop An object from the form in mod_form.php * @param stdClass $workshop An object from the form in mod_form.php
* @return int The id of the newly inserted workshop record * @return int The id of the newly inserted workshop record
*/ */
function workshop_add_instance(stdclass $workshop) { function workshop_add_instance(stdclass $workshop) {
@ -111,7 +111,7 @@ function workshop_add_instance(stdclass $workshop) {
* (defined by the form in mod_form.php) this function * (defined by the form in mod_form.php) this function
* will update an existing instance with new data. * will update an existing instance with new data.
* *
* @param stdclass $workshop An object from the form in mod_form.php * @param stdClass $workshop An object from the form in mod_form.php
* @return bool success * @return bool success
*/ */
function workshop_update_instance(stdclass $workshop) { function workshop_update_instance(stdclass $workshop) {
@ -311,7 +311,7 @@ function workshop_user_complete($course, $user, $mod, $workshop) {
* that has occurred in workshop activities and print it out. * that has occurred in workshop activities and print it out.
* Return true if there was output, or false is there was none. * Return true if there was output, or false is there was none.
* *
* @param stdclass $course * @param stdClass $course
* @param bool $viewfullnames * @param bool $viewfullnames
* @param int $timestart * @param int $timestart
* @return boolean * @return boolean
@ -1015,9 +1015,9 @@ function workshop_get_extra_capabilities() {
* Needed by grade_update_mod_grades() in lib/gradelib.php. Also used by * Needed by grade_update_mod_grades() in lib/gradelib.php. Also used by
* {@link workshop_update_grades()}. * {@link workshop_update_grades()}.
* *
* @param stdclass $workshop instance object with extra cmidnumber and modname property * @param stdClass $workshop instance object with extra cmidnumber and modname property
* @param stdclass $submissiongrades data for the first grade item * @param stdClass $submissiongrades data for the first grade item
* @param stdclass $assessmentgrades data for the second grade item * @param stdClass $assessmentgrades data for the second grade item
* @return void * @return void
*/ */
function workshop_grade_item_update(stdclass $workshop, $submissiongrades=null, $assessmentgrades=null) { function workshop_grade_item_update(stdclass $workshop, $submissiongrades=null, $assessmentgrades=null) {
@ -1047,7 +1047,7 @@ function workshop_grade_item_update(stdclass $workshop, $submissiongrades=null,
* *
* Needed by grade_update_mod_grades() in lib/gradelib.php * Needed by grade_update_mod_grades() in lib/gradelib.php
* *
* @param stdclass $workshop instance object with extra cmidnumber and modname property * @param stdClass $workshop instance object with extra cmidnumber and modname property
* @param int $userid update grade of specific user only, 0 means all participants * @param int $userid update grade of specific user only, 0 means all participants
* @return void * @return void
*/ */
@ -1106,9 +1106,9 @@ function workshop_update_grades(stdclass $workshop, $userid=0) {
* The file area workshop_intro for the activity introduction field is added automatically * The file area workshop_intro for the activity introduction field is added automatically
* by {@link file_browser::get_file_info_context_module()} * by {@link file_browser::get_file_info_context_module()}
* *
* @param stdclass $course * @param stdClass $course
* @param stdclass $cm * @param stdClass $cm
* @param stdclass $context * @param stdClass $context
* @return array of [(string)filearea] => (string)description * @return array of [(string)filearea] => (string)description
*/ */
function workshop_get_file_areas($course, $cm, $context) { function workshop_get_file_areas($course, $cm, $context) {
@ -1132,9 +1132,9 @@ function workshop_get_file_areas($course, $cm, $context) {
* Besides that, areas workshop_instructauthors and mod_workshop instructreviewers contain the media * Besides that, areas workshop_instructauthors and mod_workshop instructreviewers contain the media
* embedded using the mod_form.php. * embedded using the mod_form.php.
* *
* @param stdclass $course * @param stdClass $course
* @param stdclass $cm * @param stdClass $cm
* @param stdclass $context * @param stdClass $context
* @param string $filearea * @param string $filearea
* @param array $args * @param array $args
* @param bool $forcedownload * @param bool $forcedownload
@ -1216,11 +1216,11 @@ function workshop_pluginfile($course, $cm, $context, $filearea, array $args, $fo
/** /**
* File browsing support for workshop file areas * File browsing support for workshop file areas
* *
* @param stdclass $browser * @param stdClass $browser
* @param stdclass $areas * @param stdClass $areas
* @param stdclass $course * @param stdClass $course
* @param stdclass $cm * @param stdClass $cm
* @param stdclass $context * @param stdClass $context
* @param string $filearea * @param string $filearea
* @param int $itemid * @param int $itemid
* @param string $filepath * @param string $filepath
@ -1301,9 +1301,9 @@ function workshop_get_file_info($browser, $areas, $course, $cm, $context, $filea
* This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly. * This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly.
* *
* @param navigation_node $navref An object representing the navigation tree node of the workshop module instance * @param navigation_node $navref An object representing the navigation tree node of the workshop module instance
* @param stdclass $course * @param stdClass $course
* @param stdclass $module * @param stdClass $module
* @param stdclass $cm * @param stdClass $cm
*/ */
function workshop_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, stdclass $cm) { function workshop_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, stdclass $cm) {
global $CFG; global $CFG;

View file

@ -163,10 +163,10 @@ class workshop {
* Makes deep copy of all passed records properties. Replaces integer $course attribute * Makes deep copy of all passed records properties. Replaces integer $course attribute
* with a full database record (course should not be stored in instances table anyway). * with a full database record (course should not be stored in instances table anyway).
* *
* @param stdclass $dbrecord Workshop instance data from {workshop} table * @param stdClass $dbrecord Workshop instance data from {workshop} table
* @param stdclass $cm Course module record as returned by {@link get_coursemodule_from_id()} * @param stdClass $cm Course module record as returned by {@link get_coursemodule_from_id()}
* @param stdclass $course Course record from {course} table * @param stdClass $course Course record from {course} table
* @param stdclass $context The context of the workshop instance * @param stdClass $context The context of the workshop instance
*/ */
public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null) { public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null) {
foreach ($dbrecord as $field => $value) { foreach ($dbrecord as $field => $value) {
@ -213,7 +213,7 @@ class workshop {
/** /**
* Returns an array of options for the editors that are used for submitting and assessing instructions * Returns an array of options for the editors that are used for submitting and assessing instructions
* *
* @param stdclass $context * @param stdClass $context
* @return array * @return array
*/ */
public static function instruction_editors_options(stdclass $context) { public static function instruction_editors_options(stdclass $context) {
@ -631,7 +631,7 @@ class workshop {
/** /**
* Prepares component containing summary of given example to be rendered * Prepares component containing summary of given example to be rendered
* *
* @param stdclass $example as returned by {@link workshop::get_examples_for_manager()} or {@link workshop::get_examples_for_reviewer()} * @param stdClass $example as returned by {@link workshop::get_examples_for_manager()} or {@link workshop::get_examples_for_reviewer()}
* @return stdclass component to be rendered * @return stdclass component to be rendered
*/ */
public function prepare_example_summary(stdclass $example) { public function prepare_example_summary(stdclass $example) {
@ -659,7 +659,7 @@ class workshop {
/** /**
* Removes the submission and all relevant data * Removes the submission and all relevant data
* *
* @param stdclass $submission record to delete * @param stdClass $submission record to delete
* @return void * @return void
*/ */
public function delete_submission(stdclass $submission) { public function delete_submission(stdclass $submission) {
@ -792,7 +792,7 @@ class workshop {
/** /**
* Allocate a submission to a user for review * Allocate a submission to a user for review
* *
* @param stdclass $submission Submission object with at least id property * @param stdClass $submission Submission object with at least id property
* @param int $reviewerid User ID * @param int $reviewerid User ID
* @param int $weight of the new assessment, from 0 to 16 * @param int $weight of the new assessment, from 0 to 16
* @param bool $bulk repeated inserts into DB expected * @param bool $bulk repeated inserts into DB expected
@ -1681,7 +1681,7 @@ class workshop {
* Returns the mform the teachers use to put a feedback for the reviewer * Returns the mform the teachers use to put a feedback for the reviewer
* *
* @param moodle_url $actionurl * @param moodle_url $actionurl
* @param stdclass $assessment * @param stdClass $assessment
* @param array $options editable, editableweight, overridablegradinggrade * @param array $options editable, editableweight, overridablegradinggrade
* @return workshop_feedbackreviewer_form * @return workshop_feedbackreviewer_form
*/ */
@ -1717,7 +1717,7 @@ class workshop {
* Returns the mform the teachers use to put a feedback for the author on their submission * Returns the mform the teachers use to put a feedback for the author on their submission
* *
* @param moodle_url $actionurl * @param moodle_url $actionurl
* @param stdclass $submission * @param stdClass $submission
* @param array $options editable * @param array $options editable
* @return workshop_feedbackauthor_form * @return workshop_feedbackauthor_form
*/ */
@ -1838,7 +1838,7 @@ class workshop {
$current = $assessment->aggregatedgrade; $current = $assessment->aggregatedgrade;
} }
if (!is_null($assessment->gradinggradeover)) { if (!is_null($assessment->gradinggradeover)) {
// the grading grade for this assessment is overriden by a teacher // the grading grade for this assessment is overridden by a teacher
$sumgrades += $assessment->gradinggradeover; $sumgrades += $assessment->gradinggradeover;
$count++; $count++;
} else { } else {
@ -2270,7 +2270,7 @@ class workshop_user_plan implements renderable {
} }
} }
// Add phase swithing actions // Add phase switching actions
if (has_capability('mod/workshop:switchphase', $workshop->context, $userid)) { if (has_capability('mod/workshop:switchphase', $workshop->context, $userid)) {
foreach ($this->phases as $phasecode => $phase) { foreach ($this->phases as $phasecode => $phase) {
if (! $phase->active) { if (! $phase->active) {

View file

@ -169,7 +169,7 @@ class mod_workshop_mod_form extends moodleform_mod {
$mform->addElement('date_time_selector', 'assessmentend', $label, array('optional' => true)); $mform->addElement('date_time_selector', 'assessmentend', $label, array('optional' => true));
$mform->setAdvanced('assessmentend'); $mform->setAdvanced('assessmentend');
// Common module settinga, Restrict availability, Activity completion etc. ---- // Common module settings, Restrict availability, Activity completion etc. ----
$features = array('groups'=>true, 'groupings'=>true, 'groupmembersonly'=>true, $features = array('groups'=>true, 'groupings'=>true, 'groupmembersonly'=>true,
'outcomes'=>true, 'gradecat'=>false, 'idnumber'=>false); 'outcomes'=>true, 'gradecat'=>false, 'idnumber'=>false);

View file

@ -97,7 +97,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
* authorid, authorfirstname, authorlastname, authorpicture, authorimagealt and email. Optional * authorid, authorfirstname, authorlastname, authorpicture, authorimagealt and email. Optional
* property is status (graded, notgraded). * property is status (graded, notgraded).
* *
* @param stdclass $submission The submission record * @param stdClass $submission The submission record
* @param bool $showauthorname Should the author name be displayed * @param bool $showauthorname Should the author name be displayed
* @return string html to be echoed * @return string html to be echoed
*/ */
@ -157,7 +157,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
* *
* By default, this looks similar to a forum post. * By default, this looks similar to a forum post.
* *
* @param stdclass $submission The submission data * @param stdClass $submission The submission data
* @param bool $showauthorname Should the author name be displayed * @param bool $showauthorname Should the author name be displayed
* @return string html to be echoed * @return string html to be echoed
*/ */
@ -218,7 +218,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
* If format==html, then format a html string. If format==text, then format a text-only string. * If format==html, then format a html string. If format==text, then format a text-only string.
* Otherwise, returns html for non-images and html to display the image inline. * Otherwise, returns html for non-images and html to display the image inline.
* *
* @param stdclass $submission Submission record * @param stdClass $submission Submission record
* @param string format The format of the returned string * @param string format The format of the returned string
* @return string HTML code to be echoed * @return string HTML code to be echoed
*/ */
@ -282,7 +282,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
* *
* The passed submission object must define at least: id and title * The passed submission object must define at least: id and title
* *
* @param stdclass $data prepared by workshop::prepare_example_summary() * @param stdClass $data prepared by workshop::prepare_example_summary()
* @return string html to be echoed * @return string html to be echoed
*/ */
public function example_summary(stdclass $summary) { public function example_summary(stdclass $summary) {
@ -328,7 +328,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
* *
* By default, this looks similar to a forum post. * By default, this looks similar to a forum post.
* *
* @param stdclass $example The example submission data * @param stdClass $example The example submission data
* @return string html to be echoed * @return string html to be echoed
*/ */
public function example_full(stdclass $example) { public function example_full(stdclass $example) {
@ -405,7 +405,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
/** /**
* Renders the tasks for the single phase in the user plan * Renders the tasks for the single phase in the user plan
* *
* @param stdclass $tasks * @param stdClass $tasks
* @return string html code * @return string html code
*/ */
protected function user_plan_tasks(array $tasks) { protected function user_plan_tasks(array $tasks) {
@ -441,8 +441,8 @@ class mod_workshop_renderer extends plugin_renderer_base {
* Grades must be already rounded to the set number of decimals or must be null (in which later case, * Grades must be already rounded to the set number of decimals or must be null (in which later case,
* the [[nullgrade]] string shall be displayed). * the [[nullgrade]] string shall be displayed).
* *
* @param stdclass $data prepared by {@link workshop::prepare_grading_report()} * @param stdClass $data prepared by {@link workshop::prepare_grading_report()}
* @param stdclass $options display options object with properties ->showauthornames ->showreviewernames ->sortby ->sorthow * @param stdClass $options display options object with properties ->showauthornames ->showreviewernames ->sortby ->sorthow
* ->showsubmissiongrade ->showgradinggrade * ->showsubmissiongrade ->showgradinggrade
* @return string html code * @return string html code
*/ */
@ -618,7 +618,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
} }
/** /**
* @param stdclass $participant * @param stdClass $participant
* @param array $userinfo * @param array $userinfo
* @return string * @return string
*/ */
@ -631,7 +631,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
} }
/** /**
* @param stdclass $participant * @param stdClass $participant
* @return string * @return string
*/ */
protected function grading_report_submission(stdclass $participant) { protected function grading_report_submission(stdclass $participant) {
@ -650,7 +650,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
/** /**
* @todo Highlight the nulls * @todo Highlight the nulls
* @param stdclass|null $assessment * @param stdClass|null $assessment
* @param bool $shownames * @param bool $shownames
* @param string $separator between the grade and the reviewer/author * @param string $separator between the grade and the reviewer/author
* @return string * @return string

View file

@ -82,7 +82,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch = array(); // batch of a submission's assessments $batch = array(); // batch of a submission's assessments
$batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => null); $batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => null);
$DB->expectNever('update_record'); $DB->expectNever('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -94,7 +94,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => 10.12345); $batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => 10.12345);
$expected = 10.12345; $expected = 10.12345;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -107,7 +107,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => null); $batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => null);
$expected = 45.54321; $expected = 45.54321;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -119,7 +119,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 4, 'grade' => 14.00012); $batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 4, 'grade' => 14.00012);
$expected = 14.00012; $expected = 14.00012;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -134,7 +134,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => null, 'weight' => 1, 'grade' => 0.00000); $batch[] = (object)array('submissionid' => 45, 'submissiongrade' => null, 'weight' => 1, 'grade' => 0.00000);
$expected = 19.67750; $expected = 19.67750;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -149,7 +149,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 12.57750, 'weight' => 1, 'grade' => 0.00000); $batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 12.57750, 'weight' => 1, 'grade' => 0.00000);
$expected = 19.67750; $expected = 19.67750;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -163,7 +163,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 19.67750, 'weight' => 1, 'grade' => 10.00000); $batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 19.67750, 'weight' => 1, 'grade' => 10.00000);
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 19.67750, 'weight' => 1, 'grade' => 0.00000); $batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 19.67750, 'weight' => 1, 'grade' => 0.00000);
$DB->expectNever('update_record'); $DB->expectNever('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -177,7 +177,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => null, 'weight' => 1, 'grade' => 1.00000); $batch[] = (object)array('submissionid' => 45, 'submissiongrade' => null, 'weight' => 1, 'grade' => 1.00000);
$expected = 2.33333; $expected = 2.33333;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -192,7 +192,7 @@ class workshop_internal_api_test extends UnitTestCase {
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => null, 'weight' => 0, 'grade' => 1000.00000); $batch[] = (object)array('submissionid' => 45, 'submissiongrade' => null, 'weight' => 0, 'grade' => 1000.00000);
$expected = 17.66667; $expected = 17.66667;
$DB->expectOnce('update_record'); $DB->expectOnce('update_record');
// excercise SUT // exercise SUT
$this->workshop->aggregate_submission_grades_process($batch); $this->workshop->aggregate_submission_grades_process($batch);
} }
@ -357,7 +357,7 @@ class workshop_internal_api_test extends UnitTestCase {
} }
public function test_lcm() { public function test_lcm() {
// fixture setup + excercise SUT + verify in one step // fixture setup + exercise SUT + verify in one step
$this->assertEqual(workshop::lcm(1,4), 4); $this->assertEqual(workshop::lcm(1,4), 4);
$this->assertEqual(workshop::lcm(2,4), 4); $this->assertEqual(workshop::lcm(2,4), 4);
$this->assertEqual(workshop::lcm(4,2), 4); $this->assertEqual(workshop::lcm(4,2), 4);