From 85734f653911419c8a5dc8f4fd27a91ef3ba39ca Mon Sep 17 00:00:00 2001 From: Jack Brinkman Date: Tue, 2 Apr 2024 11:38:14 +1000 Subject: [PATCH] Removed bespoke refAssess configuration from application.groovy, fixed integer casting of maxRecordsToCreate config property --- grails-app/conf/application.groovy | 7 ------- .../ala/biocollect/ReferenceAssessmentController.groovy | 7 ++++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/grails-app/conf/application.groovy b/grails-app/conf/application.groovy index 9f4b197d3..296b787ad 100644 --- a/grails-app/conf/application.groovy +++ b/grails-app/conf/application.groovy @@ -674,10 +674,3 @@ if (!app.file.script.path) { app.file.script.path = "/data/biocollect/scripts" } script.read.extensions.list = ['js','min.js','png', 'json', 'jpg', 'jpeg'] - - - -refAssess.hub = 'hcat' -refAssess.reference.projectActivityId = 'e5a03b7e-17e3-4ea0-872f-d2a58a1becd7' -refAssess.assessment.projectActivityId = '5da93123-96b3-4209-b3ca-527749cd7970' -refAssess.assessment.maxRecordsToCreate = 8 diff --git a/grails-app/controllers/au/org/ala/biocollect/ReferenceAssessmentController.groovy b/grails-app/controllers/au/org/ala/biocollect/ReferenceAssessmentController.groovy index 7dd8549e1..6f646f9b3 100644 --- a/grails-app/controllers/au/org/ala/biocollect/ReferenceAssessmentController.groovy +++ b/grails-app/controllers/au/org/ala/biocollect/ReferenceAssessmentController.groovy @@ -101,12 +101,13 @@ class ReferenceAssessmentController { // Get the activity records for the reference survey def refActivities = activityService.activitiesForProjectActivity(config.reference.projectActivityId) + def maxRecordsToCreate = config.assessment.maxRecordsToCreate as Integer // Ensure the reference records exist def numRefActivities = refActivities?.size() - if (numRefActivities == 0 || numRefActivities < config.assessment.maxRecordsToCreate) { + if (numRefActivities == 0) { response.status = 404 - result = [message: 'Insufficient number of reference records found in reference survey'] + result = [message: 'No reference records found in reference survey'] render result as JSON return } @@ -143,7 +144,7 @@ class ReferenceAssessmentController { def assessActivities = [] for ( int projectIndex = 0; - projectIndex < Math.min(config.assessment.maxRecordsToCreate, refActivities.size()); + projectIndex < Math.min(maxRecordsToCreate, refActivities.size()); projectIndex++ ) { assessActivities.push(