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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user