Fix query for getting unhandled reports

This commit is contained in:
Keir Nellyer 2016-08-19 14:30:59 +01:00
parent ee78cf2bb9
commit 373c82c11b

View File

@ -75,10 +75,10 @@ public class ReportRepository
private static final String GET_UNHANDLED_REPORTS = "SELECT reports.id FROM reports" +
" LEFT JOIN reportResults ON reports.id = reportResults.reportId" +
" LEFT JOIN reportHandlers ON reports.id = reportHandlers.reportId" +
" AND (reportHandlers.aborted IS FALSE" +
" AND reportHandlers.handlerId != ?)" +
"WHERE reportResults.reportId IS NULL" +
" AND (reportHandlers.reportId IS NULL" +
" OR (reportHandlers.aborted IS TRUE" +
" AND reportHandlers.handlerId != ?));";
" AND reportHandlers.reportId IS NULL;";
private static final String GET_ONGOING_REPORT = "SELECT reports.id FROM reports" +
" LEFT JOIN reportResults ON reports.id = reportResults.reportId" +