Modify GET_REPORTS_HANDLING query to ignore closed reports

This commit is contained in:
Keir Nellyer 2016-07-09 14:38:12 -04:00
parent c98c352546
commit 1eb3fb4aa3

View File

@ -71,10 +71,13 @@ public class ReportRepository
" AND reports.suspectId = ?" +
" AND reports.categoryId = ?;";
private static final String GET_REPORTS_HANDLING = "SELECT reports.id FROM reports, reportHandlers, reportResults" +
" WHERE reports.id = reportHandlers.reportId" +
" AND reports.id = reportResults.reportId" +
" AND reportHandlers.handlerId = ?;";
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 reports.id = reportHandlers.reportId" +
" AND reports.id = reportResults.reportId" +
" AND 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" +