Skip to content
Permalink
Browse files

Add "Unanswered" status for unique questions see BT#15579

  • Loading branch information...
jmontoyaa committed May 7, 2019
1 parent e3921c6 commit 94b7ca55b6648fdb01136c13d0d0334ef9b344d7
@@ -2487,6 +2487,13 @@ div.admin_section h4 {
float: left;
}

.ribbon .rib-info {
background: deepskyblue;
border-top: none;
border-bottom: none;
float: left;
}

.ribbon .rib-gray {
background: #cccccc;
background-image: -ms-linear-gradient(top, #bbbbbb, #cccccc);
@@ -3445,6 +3445,8 @@ public function manage_answer(
if ($debug) {
error_log('Start answer loop ');
}
$userAnsweredQuestion = false;
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
@@ -3476,6 +3478,9 @@ public function manage_answer(
$result = Database::query($sql);
$choice = Database::result($result, 0, 'answer');
if ($userAnsweredQuestion === false) {
$userAnsweredQuestion = !empty($choice);
}
$studentChoice = $choice == $answerAutoId ? 1 : 0;
if ($studentChoice) {
$questionScore += $answerWeighting;
@@ -5353,6 +5358,7 @@ public function manage_answer(
'threadhold2' => $threadhold2,
'threadhold3' => $threadhold3,
];
if ($from == 'exercise_result') {
// if answer is hotspot. To the difference of exercise_show.php,
// we use the results from the session (from_db=0)
@@ -5754,17 +5760,18 @@ public function manage_answer(
}
}
$return_array = [
$return = [
'score' => $questionScore,
'weight' => $questionWeighting,
'extra' => $extra_data,
'open_question' => $arrques,
'open_answer' => $arrans,
'answer_type' => $answerType,
'generated_oral_file' => $generatedFile,
'user_answered' => $userAnsweredQuestion,
];
return $return_array;
return $return;
}
/**
@@ -925,6 +925,10 @@ function getFCK(vals, marksid) {
$score['score'] = $my_total_score;
$score['weight'] = $my_total_weight;
$score['comments'] = isset($comnt) ? $comnt : null;
if (isset($question_result['user_answered'])) {
$score['user_answered'] = $question_result['user_answered'];
}
}
if (in_array($objQuestionTmp->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
@@ -2005,28 +2005,42 @@ public function return_header(Exercise $exercise, $counter = null, $score = [])
$class = 'success';
}
if (in_array($this->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
$score['revised'] = isset($score['revised']) ? $score['revised'] : false;
if ($score['revised'] == true) {
$scoreLabel = get_lang('Revised');
$class = '';
} else {
$scoreLabel = get_lang('NotRevised');
$class = 'warning';
if (isset($score['weight'])) {
$weight = float_format($score['weight'], 1);
$score['result'] = ' ? / '.$weight;
}
$model = ExerciseLib::getCourseScoreModel();
if (!empty($model)) {
$score['result'] = ' ? ';
}
switch ($this->type) {
case FREE_ANSWER:
case ORAL_EXPRESSION:
case ANNOTATION:
$score['revised'] = isset($score['revised']) ? $score['revised'] : false;
if ($score['revised'] == true) {
$scoreLabel = get_lang('Revised');
$class = '';
} else {
$scoreLabel = get_lang('NotRevised');
$class = 'warning';
if (isset($score['weight'])) {
$weight = float_format($score['weight'], 1);
$score['result'] = ' ? / '.$weight;
}
$model = ExerciseLib::getCourseScoreModel();
if (!empty($model)) {
$score['result'] = ' ? ';
}
$hide = api_get_configuration_value('hide_free_question_score');
if ($hide === true) {
$score['result'] = '-';
$hide = api_get_configuration_value('hide_free_question_score');
if ($hide === true) {
$score['result'] = '-';
}
}
}
break;
case UNIQUE_ANSWER:
if ($exercise->results_disabled == RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER) {
if (isset($score['user_answered'])) {
if ($score['user_answered'] === false) {
$scoreLabel = get_lang('Unanswered');
$class = 'info';
}
}
}
break;
}
// display question category, if any
@@ -2038,6 +2052,7 @@ public function return_header(Exercise $exercise, $counter = null, $score = [])
if ($show_media) {
$header .= $this->show_media_content();
}
$scoreCurrent = [
'used' => isset($score['score']) ? $score['score'] : '',
'missing' => isset($score['weight']) ? $score['weight'] : '',
@@ -4678,6 +4678,7 @@ public static function displayQuestionListByAttempt(
'score' => $my_total_score,
'weight' => $my_total_weight,
'comments' => $comnt,
'user_answered' => $result['user_answered'],
];
}

0 comments on commit 94b7ca5

Please sign in to comment.
You can’t perform that action at this time.