diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 14df953436..6fb5538244 100644 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -698,7 +698,7 @@ if($_configuration['tracking_enabled']) $from = $_SESSION[_user]['mail']; $from_name = $_SESSION[_user]['firstName']." ".$_SESSION[_user]['lastName']; $url = $_SESSION['checkDokeosURL'].'claroline/exercice/exercice.php?'.api_get_cidreq().'&show=result'; - print_r($_POST); + foreach ($_POST as $key=>$v) { $keyexp = explode('_',$key); @@ -730,6 +730,21 @@ if($_configuration['tracking_enabled']) } + + $qry = 'SELECT DISTINCT question_id, marks + FROM `'.$TABLETRACK_ATTEMPT.'` where exe_id = '.intval($id).' + GROUP BY question_id'; + + $res = api_sql_query($qry,__FILE__,__LINE__); + $tot = 0; + while($row = mysql_fetch_assoc($res)) + { + $tot += $row ['marks']; + } + + $totquery = "update `$TBL_TRACK_EXERCICES` set exe_result = $tot where exe_Id=$id"; + + api_sql_query($totquery, __FILE__, __LINE__); $subject = "Examsheet viewed/corrected/commented by teacher"; $message = "
@@ -784,7 +799,6 @@ $message = "You attempt for the test #test# has been viewed/commented/correct $headers .= "Content-Transfer-Encoding: 7bit"; $headers .= 'From: '.$from_name.' <'.$from.'>' . "\r\n"; $headers="From:$from_name\r\nReply-to: $to\r\nContent-type: text/html; charset=iso-8859-15"; - echo 'envoi d\'un mail � '.$emailid; //mail($emailid, $subject, $mess,$headers); @@ -815,7 +829,7 @@ $message = "
You attempt for the test #test# has been viewed/commented/correct FROM $TBL_EXERCICES AS ce , `$TBL_TRACK_EXERCICES` AS te, $TBL_USER AS user WHERE `te`.`exe_exo_id` = `ce`.`id` AND `user_id`=`te`.`exe_user_id` AND `te`.`exe_cours_id`='$_cid' ORDER BY `te`.`exe_cours_id` ASC, `ce`.`title` ASC, `te`.`exe_date`ASC"; - + $hpsql="SELECT CONCAT(tu.lastname,' ',tu.firstname), tth.exe_name, tth.exe_result , tth.exe_weighting, UNIX_TIMESTAMP(tth.exe_date) FROM `$TBL_TRACK_HOTPOTATOES` tth, $TBL_USER tu diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 608e4bccd1..a5bc178699 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -528,29 +528,15 @@ $result =api_sql_query($query, __FILE__, __LINE__); selectNbrAnswers(); - $questionScore=0; - for($answerId=1;$answerId <= $nbrAnswers;$answerId++) - { - $answer=$objAnswerTmp->selectAnswer($answerId); - $answerComment=$objAnswerTmp->selectComment($answerId); - $answerCorrect=$objAnswerTmp->isCorrect($answerId); - $answerWeighting=$objAnswerTmp->selectWeighting($answerId); - $queryfree = "select marks from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; - $resfree = api_sql_query($queryfree, __FILE__, __LINE__); - $questionScore= mysql_result($resfree,0,"marks"); - //to assign marks to open question - $totalScore+=$questionScore; - $query = "select answer from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; - $resq=api_sql_query($query); - $choice = mysql_result($resq,0,"answer"); - ?> + $questionScore=0; + $query = "select answer, marks from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $resq=api_sql_query($query); + $choice = mysql_result($resq,0,"answer"); + $questionScore = mysql_result($resq,0,"marks"); + ?>