[svn r13267] fix a major bug in hotspots : the results were not stored. track_e_hotspot has been added.

skala
Eric Marguin 19 years ago
parent 20eb7eed37
commit 08740628be
  1. 10
      main/exercice/exercise_result.php
  2. 7
      main/exercice/exercise_show.php
  3. 24
      main/exercice/hotspot_answers.as.php
  4. 1
      main/inc/lib/database.lib.php
  5. 19
      main/install/dokeos_stats.sql
  6. 21
      main/install/migrate-db-1.8.3-1.8.4-pre.sql

@ -25,7 +25,7 @@
* @package dokeos.exercise
* @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring
* @version $Id: exercise_result.php 13177 2007-09-21 14:50:21Z elixir_inter $
* @version $Id: exercise_result.php 13267 2007-09-26 07:57:09Z elixir_inter $
*
* @todo split more code up in functions, move functions to library?
*/
@ -656,6 +656,14 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
}
elseif($answerType == HOT_SPOT)
{
$tbl_track_e_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// Save into db
$sql = "INSERT INTO $tbl_track_e_hotspot (`hotspot_user_id` , `hotspot_course_code` , `hotspot_exe_id` , `hotspot_question_id` , `hotspot_answer_id` , `hotspot_correct` , `hotspot_coordinate` )
VALUES ('".$_user['user_id']."', '".$_course['id']."', '$exeId', '$questionId', '$answerId', '$studentChoice', '".$_SESSION['exerciseResultCoordinates'][$questionId][$answerId]."')";
$result = api_sql_query($sql,__FILE__,__LINE__);
display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
}
elseif($answerType == HOT_SPOT_ORDER)

@ -695,10 +695,11 @@ $result =api_sql_query($query, __FILE__, __LINE__);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
$query = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId";
$TBL_TRACK_HOTSPOT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$query = "select hotspot_correct from ".$TBL_TRACK_HOTSPOT." where hotspot_exe_id = $id and hotspot_question_id= $questionId AND hotspot_answer_id=$answerId";
$resq=api_sql_query($query);
$choice = mysql_result($resq,0,"answer");
$choice = mysql_result($resq,0,"correct");
display_hotspot_answer($answerId,$answer,$choice,$answerComment);
$i++;

@ -91,13 +91,31 @@ for ($i; $i <= 12; $i++)
// set vars
$questionId = $_GET['modifyAnswers'];
$courseCode = $_course['sysCode'];
$course_code = $_course['id'];
// Get clicks
foreach ($_SESSION['exerciseResultCoordinates'][$questionId] as $coordinate)
/*if(isset($_SESSION['exerciseResultCoordinates']))
{
$output2 .= $coordinate."|";
foreach ($_SESSION['exerciseResultCoordinates'][$questionId] as $coordinate)
{
$output2 .= $coordinate."|";
}
}
else
{*/
// get it from db
$tbl_track_e_hotspot = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$sql = 'SELECT hotspot_coordinate
FROM '.$tbl_track_e_hotspot.'
WHERE hotspot_question_id = '.intval($questionId).'
AND hotspot_course_code = "'.Database::escape_string($course_code).'"';
error_log($sql);
$rs = @api_sql_query($sql); // don't output error because we are in Flash execution.
while($row = Database :: fetch_array($rs))
{
$output2 .= $row['hotspot_coordinate']."|";
}
//}
$output .= "&p_hotspot_answers=".substr($output2,0,-1)."&done=done";

@ -78,6 +78,7 @@ define('TABLE_STATISTIC_TRACK_E_EXERCICES', 'track_e_exercices');
define('TABLE_STATISTIC_TRACK_E_ATTEMPT', 'track_e_attempt');
define('TABLE_STATISTIC_TRACK_E_DEFAULT', 'track_e_default');
define('TABLE_STATISTIC_TRACK_E_UPLOADS','track_e_uploads');
define('TABLE_STATISTIC_TRACK_E_HOTSPOT','track_e_hotspot');
//scorm database tables
define('TABLE_SCORM_MAIN', 'scorm_main');

@ -178,6 +178,23 @@ CREATE TABLE track_e_course_access (
counter int NOT NULL,
PRIMARY KEY (course_access_id)
);
CREATE TABLE `track_e_hotspot` (
`hotspot_id` int(11) NOT NULL auto_increment,
`hotspot_user_id` int(11) NOT NULL,
`hotspot_course_code` varchar(50) NOT NULL,
`hotspot_exe_id` int(11) NOT NULL,
`hotspot_question_id` int(11) NOT NULL,
`hotspot_answer_id` int(11) NOT NULL,
`hotspot_correct` tinyint(3) unsigned NOT NULL,
`hotspot_coordinate` varchar(50) NOT NULL,
PRIMARY KEY (`hotspot_id`),
KEY `hotspot_course_code` (`hotspot_course_code`),
KEY `hotspot_user_id` (`hotspot_user_id`),
KEY `hotspot_exe_id` (`hotspot_exe_id`),
KEY `hotspot_question_id` (`hotspot_question_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE track_e_course_access ADD INDEX (user_id);
ALTER TABLE track_e_course_access ADD INDEX (login_course_date);
ALTER TABLE track_e_course_access ADD INDEX (course_code);
ALTER TABLE track_e_course_access ADD INDEX (course_code);

@ -24,11 +24,28 @@ INSERT INTO settings_current(variable,subkey,type,category,selected_value,title,
INSERT INTO settings_options(variable,value,display_text) VALUES ('default_forum_view', 'flat', 'Flat');
INSERT INTO settings_options(variable,value,display_text) VALUES ('default_forum_view', 'threaded', 'Threaded');
INSERT INTO settings_options(variable,value,display_text) VALUES ('default_forum_view', 'nested', 'Nested');
-- xxSTATSxx
-- xxSTATSxx
CREATE TABLE `track_e_hotspot` (
`hotspot_id` int(11) NOT NULL auto_increment,
`hotspot_user_id` int(11) NOT NULL,
`hotspot_course_code` varchar(50) NOT NULL,
`hotspot_exe_id` int(11) NOT NULL,
`hotspot_question_id` int(11) NOT NULL,
`hotspot_answer_id` int(11) NOT NULL,
`hotspot_correct` tinyint(3) unsigned NOT NULL,
`hotspot_coordinate` varchar(50) NOT NULL,
PRIMARY KEY (`hotspot_id`),
KEY `hotspot_course_code` (`hotspot_course_code`),
KEY `hotspot_user_id` (`hotspot_user_id`),
KEY `hotspot_exe_id` (`hotspot_exe_id`),
KEY `hotspot_question_id` (`hotspot_question_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- xxUSERxx
-- xxCOURSExx
ALTER TABLE survey ADD anonymous ENUM( '0', '1' ) NOT NULL DEFAULT '0';
ALTER TABLE lp_item ADD max_time_allowed char(13) NULL DEFAULT '';
ALTER TABLE item_property ADD INDEX (tool(20),ref);
ALTER TABLE item_property ADD INDEX (tool(20),ref);

Loading…
Cancel
Save