A report is no longer active if a result for it has been set

This commit is contained in:
Keir Nellyer 2016-07-09 14:48:26 -04:00
parent 29b1110f6b
commit aadb3df715
3 changed files with 7 additions and 2 deletions

View File

@ -70,7 +70,7 @@ public class Report
return _category; return _category;
} }
public Optional<ReportResult> getReportResult() public Optional<ReportResult> getResult()
{ {
return Optional.ofNullable(_reportResult); return Optional.ofNullable(_reportResult);
} }

View File

@ -262,6 +262,11 @@ public class ReportManager
*/ */
public CompletableFuture<Boolean> isActiveReport(Report report) public CompletableFuture<Boolean> isActiveReport(Report report)
{ {
if (report.getResult().isPresent())
{
return CompletableFuture.completedFuture(true);
}
return calculatePriority(report).thenApply(priority -> priority > 0); return calculatePriority(report).thenApply(priority -> priority > 0);
} }

View File

@ -406,7 +406,7 @@ public class ReportRepository
setReportHandlerStatement.execute(); setReportHandlerStatement.execute();
} }
Optional<ReportResult> reportResultOptional = report.getReportResult(); Optional<ReportResult> reportResultOptional = report.getResult();
if (reportResultOptional.isPresent()) if (reportResultOptional.isPresent())
{ {
PreparedStatement setReportResultStatement = connection.prepareStatement(SET_REPORT_RESULT); PreparedStatement setReportResultStatement = connection.prepareStatement(SET_REPORT_RESULT);