Bläddra i källkod

added session_id field inside lp_view and track_e_attempt tables for working results about students in session - partial CT#663

Cristian Fasanando 15 år sedan
förälder
incheckning
a9aa255741

+ 8 - 2
main/inc/lib/add_course.lib.inc.php

@@ -1215,7 +1215,8 @@ function update_Db_course($courseDbName, $language = null)
 		"user_id		int 	unsigned	not null," . //user ID from main.user
 		"view_count		smallint unsigned	not null default 0," . //integer counting the amount of times this learning path has been attempted
 		"last_item		int		unsigned	not null default 0," . //last item seen in this view
-		"progress		int		unsigned	default 0 )" . $charset_clause; //lp's progress for this user
+		"progress		int		unsigned	default 0," .
+		"view_session_id int not null default 0 )" . $charset_clause; //lp's progress for this user
 	if(!Database::query($sql))
 	{
 		error_log($sql,0);
@@ -1230,7 +1231,12 @@ function update_Db_course($courseDbName, $language = null)
 	{
 		error_log($sql,0);
 	}
-
+	$sql = "ALTER TABLE `$TABLELPVIEW` ADD INDEX (view_session_id) ";
+	if(!Database::query($sql))
+	{
+		error_log($sql,0);
+	}
+	
 	$sql = "CREATE TABLE IF NOT EXISTS `$TABLELPITEM` (" .
 		"id				int	unsigned	primary	key auto_increment," .	//unique ID from MySQL
 		"lp_id			int unsigned	not null," .	//lp_id from 'lp'

+ 1 - 1
main/install/db_main.sql

@@ -754,7 +754,7 @@ VALUES
 ('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
 ('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
 ('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
-('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.10610','DokeosDatabaseVersion','',NULL,NULL,0);
+('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.10740','DokeosDatabaseVersion','',NULL,NULL,0);
 
 
 UNLOCK TABLES;

+ 7 - 2
main/install/db_stats.sql

@@ -126,11 +126,13 @@ CREATE TABLE track_e_attempt (
   marks float(6,2) NOT NULL default 0,
   course_code varchar(40) NOT NULL default '',
   position int default 0,
-  tms datetime NOT NULL default '0000-00-00 00:00:00'
+  tms datetime NOT NULL default '0000-00-00 00:00:00',
+  session_id INT NOT NULL DEFAULT 0
 );
 ALTER TABLE track_e_attempt ADD INDEX (exe_id);
 ALTER TABLE track_e_attempt ADD INDEX (user_id); 
 ALTER TABLE track_e_attempt ADD INDEX (question_id);
+ALTER TABLE track_e_attempt ADD INDEX (session_id);
 
 CREATE TABLE track_e_attempt_recording (
   exe_id int unsigned NOT NULL, 
@@ -138,9 +140,12 @@ CREATE TABLE track_e_attempt_recording (
   marks int NOT NULL,  
   insert_date datetime NOT NULL default '0000-00-00 00:00:00',  
   author int unsigned NOT NULL,  
-  teacher_comment text NOT NULL
+  teacher_comment text NOT NULL,
+  session_id INT NOT NULL DEFAULT 0
 );
 ALTER TABLE track_e_attempt_recording ADD INDEX (exe_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
 
 CREATE TABLE track_e_hotpotatoes (
   exe_name VARCHAR( 255 ) NOT NULL ,

+ 9 - 1
main/install/migrate-db-1.8.6.2-1.8.7-pre.sql

@@ -48,7 +48,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
 ALTER TABLE user_field_values CHANGE id id BIGINT NOT NULL AUTO_INCREMENT;
 ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
 
-UPDATE settings_current SET selected_value = '1.8.7.10610' WHERE variable = 'dokeos_database_version';
+UPDATE settings_current SET selected_value = '1.8.7.10740' WHERE variable = 'dokeos_database_version';
 
 -- xxSTATSxx
 CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, progress int NOT NULL default 0, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int  NOT NULL, session_id int NOT NULL default 0);
@@ -65,6 +65,11 @@ ALTER TABLE track_e_uploads ADD upload_session_id INT NOT NULL DEFAULT 0;
 ALTER TABLE track_e_uploads ADD INDEX (upload_session_id);
 ALTER TABLE track_e_online ADD session_id INT NOT NULL DEFAULT 0;
 ALTER TABLE track_e_online ADD INDEX (session_id);
+ALTER TABLE track_e_attempt ADD session_id INT NOT NULL DEFAULT 0;
+ALTER TABLE track_e_attempt ADD INDEX (session_id);
+ALTER TABLE track_e_attempt_recording ADD session_id INT NOT NULL DEFAULT 0;
+ALTER TABLE track_e_attempt_recording ADD INDEX (question_id);
+ALTER TABLE track_e_attempt_recording ADD INDEX (session_id);
 
 -- xxUSERxx
 
@@ -84,3 +89,6 @@ ALTER TABLE attendance_result ADD INDEX(user_id);
 CREATE TABLE attendance (id int NOT NULL auto_increment PRIMARY KEY, name text NOT NULL, description TEXT NULL, active tinyint(3) NOT NULL default 1, attendance_qualify_title varchar(255) NULL, attendance_qualify_max int NOT NULL default 0, attendance_weight float(6,2) NOT NULL default '0.0', session_id int NOT NULL default 0);
 ALTER TABLE attendance ADD INDEX(session_id);
 ALTER TABLE attendance ADD INDEX(active);
+ALTER TABLE lp_view ADD view_session_id INT NOT NULL DEFAULT 0;
+ALTER TABLE lp_view ADD INDEX(view_session_id)
+