* @return integer grade out of 1 that a random guess by a student might score.
*/
// ULPGc ecastro
-function get_random_guess_score($question) {
+function question_get_random_guess_score($question) {
global $QTYPES;
$r = $QTYPES[$question->qtype]->get_random_guess_score($question);
function col_intended_weight($question){
return quiz_report_scale_sumgrades_as_percentage($question->grade, $this->quiz);
}
-
+
function col_random_guess_score($question){
- return number_format(get_random_guess_score($question) * 100, 2).' %';
+ $randomguessscore = question_get_random_guess_score($question);
+ if (is_number($randomguessscore)){
+ return number_format($randomguessscore * 100, 2).' %';
+ } else {
+ return $randomguessscore; // empty string returned by random question.
+ }
}
-
-
}
?>
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
return 1 / count($question->options->subquestions);
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
$totalfraction = 0;
foreach (array_keys($question->options->questions) as $key){
- $totalfraction += get_random_guess_score($question->options->questions[$key]);
+ $totalfraction += question_get_random_guess_score($question->options->questions[$key]);
}
return $totalfraction / count($question->options->questions);
}
}
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
$totalfraction = 0;
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
return 0;
return $answer_field;
}
+
+ /**
+ * For random question type return empty string which means won't calculate.
+ * @param object $question
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
+ */
+ function get_random_guess_score($question) {
+ return '';
+ }
}
//// END OF CLASS ////
}
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
//Effectively $subquestions multi choice questions with equal weighting
}
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
$answers = &$question->options->answers;
}
/**
* @param object $question
- * @return integer a score out of 1 that the average random guess by a
- * student might give.
+ * @return mixed either a integer score out of 1 that the average random
+ * guess by a student might give or an empty string which means will not
+ * calculate.
*/
function get_random_guess_score($question) {
return 0.5;