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

Assign appointments in order of closest ending time

This commit is contained in:
Adam Zammit
2013-06-13 10:31:44 +10:00
parent f69d62dec6
commit 98df307ae3
2 changed files with 2 additions and 2 deletions

View File

@@ -445,7 +445,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 apn.start DESC, a.start ASC, qsep.priority DESC
ORDER BY apn.end ASC, a.start ASC, qsep.priority DESC
LIMIT 1";
//apn.appointment_id contains the id of an appointment if we are calling on an appointment