Skip to content

Commit

Permalink
Removed bespoke refAssess configuration from application.groovy, fixe…
Browse files Browse the repository at this point in the history
…d integer casting of maxRecordsToCreate config property
  • Loading branch information
jack-brinkman committed Apr 2, 2024
1 parent 708c463 commit 85734f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 0 additions & 7 deletions grails-app/conf/application.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 85734f6

Please sign in to comment.