From 88b6f9d3692c1b5b6d485d6fb7eb06d3d8c57b1d Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Thu, 10 Jul 2014 15:07:46 +1000 Subject: [PATCH] Make sure quota priority is never less than 0 Fixed bug: Process won't close itself if forced killed before it has a chance to close --- functions/functions.operator.php | 4 +++- functions/functions.process.php | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 3bad8a61..9d8f972e 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -1735,7 +1735,9 @@ function update_row_quota($questionnaire_id,$case_id = false) if ($r['autoprioritise'] == 1) { //priority is 100 - the percentage of completions - $pr = 100 - round(100 * ($completions / $r['completions'])); + $pr = 100 - round(100 * ($completions / $r['completions'])); + if ($pr < 0) + $pr = 0; $sql .= ", priority = '$pr' "; //need to update quotas now diff --git a/functions/functions.process.php b/functions/functions.process.php index 0e451bdb..12388053 100644 --- a/functions/functions.process.php +++ b/functions/functions.process.php @@ -76,7 +76,6 @@ function is_process_killed($process_id) $sql = "SELECT `process_id` FROM `process` WHERE `kill` = 1 - AND `stop` IS NULL AND `process_id` = '$process_id'"; $rs = $db->GetRow($sql);