mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
updated database file to match new schema
fixed bug when autoprioritising
This commit is contained in:
@@ -17,7 +17,8 @@ CREATE TABLE `qsqr_sample` (
|
||||
`comparison` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`description` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`qsqr_sample_id`),
|
||||
KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`)
|
||||
KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`),
|
||||
KEY `exclude_var` (`exclude_var`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
@@ -29,6 +30,12 @@ INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var,exclude_v
|
||||
SELECT questionnaire_sample_quota_row_id, exclude_var,exclude_val, 'LIKE'
|
||||
FROM questionnaire_sample_quota_row;
|
||||
|
||||
ALTER TABLE `questionnaire_sample_quota_row`
|
||||
DROP `lime_sgqa`,
|
||||
DROP `value`,
|
||||
DROP `comparison`,
|
||||
DROP `exclude_var`,
|
||||
DROP `exclude_val`;
|
||||
|
||||
|
||||
queXS 1.10.0 - Changes since 1.9.2
|
||||
|
||||
@@ -1391,7 +1391,8 @@ CREATE TABLE `qsqr_sample` (
|
||||
`comparison` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`description` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`qsqr_sample_id`),
|
||||
KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`)
|
||||
KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`),
|
||||
KEY `exclude_var` (`exclude_var`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
@@ -1543,12 +1544,7 @@ CREATE TABLE `questionnaire_sample_quota_row` (
|
||||
`questionnaire_sample_quota_row_id` bigint(20) NOT NULL auto_increment,
|
||||
`questionnaire_id` bigint(20) NOT NULL,
|
||||
`sample_import_id` bigint(20) NOT NULL,
|
||||
`lime_sgqa` varchar(255) collate utf8_unicode_ci NOT NULL,
|
||||
`value` varchar(2048) collate utf8_unicode_ci NOT NULL,
|
||||
`comparison` varchar(15) collate utf8_unicode_ci NOT NULL default 'LIKE',
|
||||
`completions` int(11) NOT NULL,
|
||||
`exclude_var` char(128) collate utf8_unicode_ci NOT NULL,
|
||||
`exclude_val` varchar(256) collate utf8_unicode_ci NOT NULL,
|
||||
`quota_reached` tinyint(1) NOT NULL default '0',
|
||||
`current_completions` int(11) NOT NULL default '0',
|
||||
`description` text collate utf8_unicode_ci NOT NULL,
|
||||
@@ -1556,8 +1552,7 @@ CREATE TABLE `questionnaire_sample_quota_row` (
|
||||
`autoprioritise` tinyint(1) NOT NULL default '0' COMMENT 'Should this row have it''s priority automatically adjusted to 100 - (completions %)',
|
||||
PRIMARY KEY (`questionnaire_sample_quota_row_id`),
|
||||
KEY `questionnaire_id` (`questionnaire_id`),
|
||||
KEY `sample_import_id` (`sample_import_id`),
|
||||
KEY `exclude_var` (`exclude_var`)
|
||||
KEY `sample_import_id` (`sample_import_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
--
|
||||
|
||||
@@ -1683,7 +1683,7 @@ function update_row_quota($questionnaire_id,$case_id = false)
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "SELECT questionnaire_sample_quota_row_id,q.questionnaire_id,sample_import_id,completions,quota_reached,q.lime_sid,qsq.current_completions,qsq.priority,qsq.autoprioritise
|
||||
$sql = "SELECT qsq.questionnaire_sample_quota_row_id,q.questionnaire_id,sample_import_id,completions,quota_reached,q.lime_sid,qsq.current_completions,qsq.priority,qsq.autoprioritise,qq.lime_sgqa
|
||||
FROM questionnaire_sample_quota_row as qsq, questionnaire as q, qsqr_question as qq
|
||||
WHERE qsq.questionnaire_id = '$questionnaire_id'
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
@@ -1703,6 +1703,7 @@ function update_row_quota($questionnaire_id,$case_id = false)
|
||||
foreach($rs as $r)
|
||||
{
|
||||
$lime_sid = $r['lime_sid'];
|
||||
$sample_import_id = $r['sample_import_id'];
|
||||
$qsqri = $r['questionnaire_sample_quota_row_id'];
|
||||
|
||||
//all variables to exclude for this row quota
|
||||
@@ -1719,7 +1720,6 @@ function update_row_quota($questionnaire_id,$case_id = false)
|
||||
|
||||
$qev = $db->GetAll($sql2);
|
||||
|
||||
|
||||
//whether a completion was changed for this quota
|
||||
$updatequota = false;
|
||||
|
||||
@@ -1964,7 +1964,7 @@ function update_quota_priorities($questionnaire_id)
|
||||
$x = 1;
|
||||
foreach ($rev as $ev)
|
||||
{
|
||||
$sql .= " AND sv$x.sample_id = s.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') ";
|
||||
$sql .= " AND sv$x.sample_id = s.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}' ";
|
||||
$x++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user