Should fix message bug in free questions see #5434

skala
Julio Montoya 12 years ago
parent afc2a57e4a
commit 36c5c22129
  1. 15
      main/exercice/exercise.class.php
  2. 2
      main/exercice/question.class.php
  3. 3
      main/inc/lib/events.lib.inc.php
  4. 10
      main/inc/lib/exercise_show_functions.lib.php

@ -2317,11 +2317,11 @@ class Exercise {
$choice = Database::result($resq,0,'answer');
$choice = str_replace('\r\n', '', $choice);
$choice = stripslashes($choice);
$questionScore = Database::result($resq,0,"marks");
if ($questionScore==-1) {
$totalScore+=0;
$questionScore = Database::result($resq, 0, "marks");
if ($questionScore == -1) {
$totalScore+= 0;
} else {
$totalScore+=$questionScore;
$totalScore+= $questionScore;
}
$arrques = $questionName;
$arrans = $choice;
@ -2357,8 +2357,7 @@ class Exercise {
$totalScore += 0;
}
}
break;
break;
// for matching
case MATCHING :
if ($from_database) {
@ -2520,7 +2519,7 @@ class Exercise {
}
} elseif($answerType == FREE_ANSWER) {
if($origin != 'learnpath') {
ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId);
ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId, $questionScore);
}
} elseif($answerType == ORAL_EXPRESSION) {
// to store the details of open questions in an array to be used in mail
@ -2730,7 +2729,7 @@ class Exercise {
ExerciseShowFunctions::display_fill_in_blanks_answer($answer,$exeId,$questionId);
break;
case FREE_ANSWER:
echo ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId);
echo ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId, $questionScore);
break;
case ORAL_EXPRESSION:
echo '<tr>

@ -1391,7 +1391,7 @@ abstract class Question
$class = 'gray';
} else {
$score_label = get_lang('NotRevised');
$class = 'gray';
$class = 'error';
}
}

@ -1329,7 +1329,8 @@ function get_all_exercises_from_lp($lp_id, $course_id) {
*/
function get_comments($exe_id, $question_id) {
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT teacher_comment FROM ".$table_track_attempt." where exe_id='".Database::escape_string($exe_id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id";
$sql = "SELECT teacher_comment FROM ".$table_track_attempt."
WHERE exe_id='".Database::escape_string($exe_id)."' AND question_id = '".Database::escape_string($question_id)."' ORDER by question_id";
$sqlres = Database::query($sql);
$comm = Database::result($sqlres, 0, "teacher_comment");
return $comm;

@ -55,7 +55,7 @@ class ExerciseShowFunctions {
* @param int Question ID
* @return void
*/
static function display_free_answer($answer, $exe_id, $questionId) {
static function display_free_answer($answer, $exe_id, $questionId, $questionScore = null) {
global $feedback_type;
$comments = get_comments($exe_id, $questionId);
@ -66,8 +66,9 @@ class ExerciseShowFunctions {
echo '</td></tr>';
}
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
if (empty($comments)) {
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
if ($questionScore > 0 || !empty($comments)) {
} else {
echo '<tr>';
echo Display::tag('td', Display::return_message(get_lang('notCorrectedYet')), array());
echo '</tr>';
@ -75,7 +76,7 @@ class ExerciseShowFunctions {
}
}
static function display_oral_expression_answer($answer,$id,$questionId, $nano = null) {
static function display_oral_expression_answer($answer, $id, $questionId, $nano = null) {
global $feedback_type;
if (isset($nano)) {
@ -83,7 +84,6 @@ class ExerciseShowFunctions {
}
if (empty($id)) {
echo '<tr>';
echo Display::tag('td',nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%'));
echo '</tr>';

Loading…
Cancel
Save