From 5b685a3a86e92baa676930207c0b6c28779fe6e9 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 19 Aug 2016 15:46:59 +0100 Subject: [PATCH] Fixed query for getting unhandled reports to behave well with abused reports --- .../core/report/data/ReportRepository.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index d7780a179..f1ca6c0a3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -72,13 +72,13 @@ public class ReportRepository " ORDER BY `time` ASC;"; // TODO confirm working - 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;"; + private static final String GET_UNHANDLED_REPORTS = "SELECT reports.id FROM reports\n" + + " LEFT JOIN reportResults ON reports.id = reportResults.reportId\n" + + " LEFT JOIN reportHandlers ON reports.id = reportHandlers.reportId\n" + + "WHERE reportResults.reportId IS NULL\n" + + "GROUP BY reports.id\n" + + "HAVING SUM(IF(reportHandlers.handlerId != ?, 1, 0)) = COUNT(reportHandlers.handlerId)\n" + + " AND SUM(IF(reportHandlers.aborted IS TRUE, 1, 0)) = COUNT(reportHandlers.handlerId);"; private static final String GET_ONGOING_REPORT = "SELECT reports.id FROM reports" + " LEFT JOIN reportResults ON reports.id = reportResults.reportId" +