2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Fixed bug: Quota priority not able to override sort of last call made

This commit is contained in:
Adam Zammit
2015-02-06 11:49:30 +11:00
parent 62ca8c9cba
commit 34802a37a7
2 changed files with 2 additions and 2 deletions

View File

@@ -638,7 +638,7 @@ function get_case_id($operator_id, $create = false)
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
AND (apn.require_operator_id IS NULL OR apn.require_operator_id = '$operator_id')
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, a.start ASC, qsep.priority DESC
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, qsep.priority DESC, a.start ASC
LIMIT 1";
//apn.appointment_id contains the id of an appointment if we are calling on an appointment