Browse Source

New type of question: Multiple answer \"Exact\" fixes

Julio Montoya 15 years ago
parent
commit
8e89f373a4
1 changed files with 14 additions and 9 deletions
  1. 14 9
      main/exercice/exercice_submit.php

+ 14 - 9
main/exercice/exercice_submit.php

@@ -432,15 +432,7 @@ if ($formSent) {
 								 		if (!$my_answer) {
 								 			$final_answer = false;
 								 		}		 		
-								 	}
-								 			 	
-								 	if ($final_answer) {
-								 		//getting only the first score where we save the weight of all the question 
-								 		$answerWeighting=$objAnswerTmp->selectWeighting(1);
-										$questionScore+=$answerWeighting;
-										$totalScore+=$answerWeighting;
-									}																	
-																									
+								 	}																
 									break;
 									// for fill in the blanks
 								case FILL_IN_BLANKS :
@@ -626,6 +618,17 @@ if ($formSent) {
 							} // end switch Answertype
 						} // end for that loops over all answers of the current question
 						// destruction of Answer
+						
+						//we add the total score after dealing with the answers
+						if ($answerType == MULTIPLE_ANSWER_COMBINATION) {
+				 			if ($final_answer) {
+					 			//getting only the first score where we save the weight of all the question 
+					 			$answerWeighting=$objAnswerTmp->selectWeighting(1);
+								$questionScore+=$answerWeighting;
+								$totalScore+=$answerWeighting;
+							}
+						}
+						
 						unset ($objAnswerTmp);
 
 						$i++;
@@ -654,6 +657,8 @@ if ($formSent) {
 									$reply = array_keys($choice);
 									for ($i = 0; $i < sizeof($reply); $i++) {
 										$ans = $reply[$i];
+										echo ($questionScore.' - '.$ans.' - '. $quesId.' - '. $exeId.' - '. $i);
+										echo '<br />';
 										exercise_attempt($questionScore, $ans, $quesId, $exeId, $i);
 									}
 								} else {