Fix query for getting reports a user is handling to ignore aborted reports

This commit is contained in:
Keir Nellyer 2016-08-19 15:03:54 +01:00
parent 514757924d
commit 2211e6c4ef

View File

@ -77,7 +77,7 @@ public class ReportRepository
" LEFT JOIN reportHandlers ON reports.id = reportHandlers.reportId" +
" AND (reportHandlers.aborted IS FALSE" +
" AND reportHandlers.handlerId != ?)" +
"WHERE reportResults.reportId IS NULL" +
" WHERE reportResults.reportId IS NULL" +
" AND reportHandlers.reportId IS NULL;";
private static final String GET_ONGOING_REPORT = "SELECT reports.id FROM reports" +
@ -92,10 +92,11 @@ public class ReportRepository
" AND reports.categoryId = ?;";
private static final String GET_REPORTS_HANDLING = "SELECT reports.id FROM reports" +
" LEFT JOIN reportResults ON reports.id = reportResults.reportId" +
" INNER JOIN reportHandlers ON reports.id = reportHandlers.reportId" +
" WHERE reportResults.reportId IS NULL" +
" AND reportHandlers.handlerId = ?;";
" LEFT JOIN reportResults ON reports.id = reportResults.reportId" +
" INNER JOIN reportHandlers ON reports.id = reportHandlers.reportId" +
" AND reportHandlers.aborted IS FALSE" +
" WHERE reportResults.reportId IS NULL" +
" AND reportHandlers.handlerId = ?;";
private static final String GET_USER_RESULT_COUNT = "SELECT COUNT(reports.id) AS resultCount" +
" FROM reports, reportReasons, reportResults" +