From 13d9c856e340063ff575c5f0540b1408848e3a55 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Tue, 8 Feb 2011 02:11:42 +0000 Subject: [PATCH] Remove unused columns from get_case_id select statement Make sure to make cases and sample records unavailable before sorting enabled ones --- admin/systemsortprocess.php | 18 ++++++++++++++++++ functions/functions.operator.php | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/admin/systemsortprocess.php b/admin/systemsortprocess.php index 53add884..b00f70c8 100644 --- a/admin/systemsortprocess.php +++ b/admin/systemsortprocess.php @@ -98,6 +98,14 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin $db->StartTrans(); + //First set all cases as unavailable + $sql = "UPDATE `case` + SET sortorder = NULL + WHERE 1"; + + $db->Execute($sql); + + //Sort current cases for all enabled questionnaires @@ -136,6 +144,16 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin $i++; } + + //First set all sample records as unavailable + $sql = "UPDATE `questionnaire_sample_exclude_priority` + SET sortorder = NULL + WHERE 1"; + + $db->Execute($sql); + + + //Sort sample list where attached to an enabled questionnaire $sql = "SELECT s.sample_id as sample_id,qs.questionnaire_id as questionnaire_id diff --git a/functions/functions.operator.php b/functions/functions.operator.php index ac7173b7..feedbe5d 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -334,7 +334,7 @@ function get_case_id($operator_id, $create = false) * @todo also could check the respondent_not_available table to see if now is a "bad time" to call */ - $sql = "SELECT c.case_id as caseid,s.*,apn.*,a.*,sh.*,op.*,cr.*,si.*,CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) as resptime + $sql = "SELECT c.case_id as caseid FROM `case` as c LEFT JOIN `call` as a on (a.call_id = c.last_call_id) JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)