MDL-32188 question CBM: minimal handling of certainty -1

Certainty -1 has never been used in standard Moodle, but is
used in Tony-Gardiner Medwin's patches to mean 'No idea' which
we intend to implement: MDL-42077. In the mean time, these changes
avoid errors for people who have used TGM's patches.
This commit is contained in:
Tim Hunt 2013-10-03 16:17:16 +01:00
parent e74aa0aa97
commit 2bf83cb218
3 changed files with 14 additions and 1 deletions

View File

@ -684,6 +684,13 @@ abstract class question_cbm {
* @return number the adjusted fraction taking the certainty into account.
*/
public static function adjust_fraction($fraction, $certainty) {
if ($certainty == -1) {
// Certainty -1 has never been used in standard Moodle, but is
// used in Tony-Gardiner Medwin's patches to mean 'No idea' which
// we intend to implement: MDL-42077. In the mean time, avoid
// errors for people who have used TGM's patches.
return 0;
}
if ($fraction <= 0.00000005) {
return self::$wrongscore[$certainty];
} else {

View File

@ -85,7 +85,11 @@ class qbehaviour_deferredcbm_type extends qbehaviour_deferredfeedback_type {
}
$certainty = $qa->get_last_behaviour_var('certainty');
if (is_null($certainty)) {
if (is_null($certainty) || $certainty == -1) {
// Certainty -1 has never been used in standard Moodle, but is
// used in Tony-Gardiner Medwin's patches to mean 'No idea' which
// we intend to implement: MDL-42077. In the mean time, avoid
// errors for people who have used TGM's patches.
$certainty = question_cbm::default_certainty();
}

View File

@ -43,9 +43,11 @@ Probability correct | <67% | 67-80% | >80%
Best marks are gained by acknowledging uncertainty. For example, if you think there is more than a 1 in 3 chance of being wrong, you should enter C=1 and avoid the risk of a negative mark.
';
$string['certainty_link'] = 'qbehaviour/deferredcbm/certainty';
$string['certainty-1'] = 'No Idea';
$string['certainty1'] = 'C=1 (Unsure: <67%)';
$string['certainty2'] = 'C=2 (Mid: >67%)';
$string['certainty3'] = 'C=3 (Quite sure: >80%)';
$string['certaintyshort-1'] = 'No Idea';
$string['certaintyshort1'] = 'C=1';
$string['certaintyshort2'] = 'C=2';
$string['certaintyshort3'] = 'C=3';