From aefcaf9c027febdbd9a51869744d7a6a978b4413 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 23 Jun 2016 17:03:29 +0200 Subject: [exams] Fix vis.js when an exam is active in more than one location (id collision), complete install hook (missing table), limit max. zoom level for vis.js --- modules-available/exams/install.inc.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'modules-available/exams/install.inc.php') diff --git a/modules-available/exams/install.inc.php b/modules-available/exams/install.inc.php index b61a0af2..aa8c9a0d 100644 --- a/modules-available/exams/install.inc.php +++ b/modules-available/exams/install.inc.php @@ -3,13 +3,26 @@ $res = array(); $res[] = tableCreate('exams', ' - `examid` int(11) NOT NULL AUTO_INCREMENT, - `starttime` int(11) NOT NULL, - `endtime` int(11) NOT NULL, - `description` varchar(100) DEFAULT NULL, - PRIMARY KEY (`examid`) - '); + `examid` int(11) NOT NULL AUTO_INCREMENT, + `starttime` int(11) NOT NULL, + `endtime` int(11) NOT NULL, + `description` varchar(100) DEFAULT NULL, + PRIMARY KEY (`examid`) + '); +$res[] = tableCreate('exams_x_location', ' + `examid` int(11) NOT NULL, + `locationid` int(11) NOT NULL, + PRIMARY KEY (`examid`, `locationid`) +'); + +if (Database::exec("ALTER TABLE exams ADD INDEX `idx_daterange` ( `starttime` , `endtime` )") === false) { + if (!preg_match('/\b1061\b/', Database::lastError())) { + finalResponse(UPDATE_FAILED, 'Could not add startdate/enddate index: ' . Database::lastError()); + } +} else { + $res[] = UPDATE_DONE; +} if (in_array(UPDATE_DONE, $res)) { finalResponse(UPDATE_DONE, 'Tables created successfully'); -- cgit v1.2.3-55-g7522