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

re-fix: list cases with "appointment" outcome only

This commit is contained in:
Alex
2015-11-30 23:07:14 +03:00
parent b013a7f538
commit 87a44c868f

View File

@@ -303,7 +303,7 @@ else {
LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
WHERE q.enabled=1 AND si.enabled=1 AND a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
WHERE q.enabled=1 AND si.enabled=1 AND a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id IN (19,20,21,22)
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1)
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
GROUP BY c.case_id ORDER BY a.start ASC";
@@ -326,7 +326,7 @@ else {
LEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id)
LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
WHERE q.enabled=1 AND si.enabled=1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id !=10
WHERE q.enabled=1 AND si.enabled=1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id IN (19,20,21,22)
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
GROUP BY c.case_id