From aa2806f34c592100085ada57df9b0c1e4f4744c1 Mon Sep 17 00:00:00 2001 From: chrisala Date: Fri, 24 May 2024 16:35:01 +1000 Subject: [PATCH 1/3] Record Monitor activities as finished #961 --- grails-app/services/au/org/ala/ecodata/ParatooService.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy index d8b3077f2..158923b8e 100644 --- a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy +++ b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy @@ -479,12 +479,13 @@ class ParatooService { formVersion : activityForm.formVersion, description : "Activity submitted by monitor", projectId : collection.projectId, - publicationStatus: "published", + publicationStatus: PublicationStatus.PUBLISHED, siteId : dataSet.siteId, startDate : dataSet.startDate, endDate : dataSet.endDate, plannedStartDate : dataSet.startDate, plannedEndDate : dataSet.endDate, + progress : Activity.FINISHED, externalIds : [new ExternalId(idType: ExternalId.IdType.MONITOR_MINTED_COLLECTION_ID, externalId: dataSet.dataSetId)], userId : userId, outputs : [[ From 4c3ebedb67769129aaf3f7e41e42e37cb09e7488 Mon Sep 17 00:00:00 2001 From: temi Date: Fri, 31 May 2024 06:45:44 +1000 Subject: [PATCH 2/3] #965 - do not create record for "Other" species --- grails-app/conf/application.groovy | 2 +- .../au/org/ala/ecodata/ParatooService.groovy | 12 +++++++++--- .../au/org/ala/ecodata/ParatooServiceSpec.groovy | 12 ++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/grails-app/conf/application.groovy b/grails-app/conf/application.groovy index da139f946..3c186a923 100644 --- a/grails-app/conf/application.groovy +++ b/grails-app/conf/application.groovy @@ -1490,4 +1490,4 @@ paratoo.defaultPlotLayoutViewModels = [ ] ] ] - +paratoo.species.specialCases = ["Other"] diff --git a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy index d8b3077f2..15cd0dfd2 100644 --- a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy +++ b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy @@ -2097,9 +2097,15 @@ class ParatooService { } result.name = result.commonName ? result.scientificName ? "${result.scientificName} (${result.commonName})" : result.commonName : result.scientificName - - // record is only created if guid is present - result.guid = result.guid ?: Record.UNMATCHED_GUID + List specialCases = grailsApplication.config.getProperty("paratoo.species.specialCases", List) + // do not create record for special cases + if (specialCases.contains(name)) { + result.remove("guid") + } + else { + // record is only created if guid is present + result.guid = result.guid ?: Record.UNMATCHED_GUID + } result } } diff --git a/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy b/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy index 83f2c4f5c..046dade64 100644 --- a/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy +++ b/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy @@ -44,6 +44,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest> null 1 * speciesReMatchService.searchByName(_, false, true) >> null + + when: // Do not create record when value equals special cases. Therefore, removes guid. + result = service.transformSpeciesName("Other") + outputSpeciesId = result.remove("outputSpeciesId") + + then: + outputSpeciesId != null + result == [name: "Other", scientificName: null, commonName: "Other", taxonRank: null] + 1 * speciesReMatchService.searchByName(_) >> null + 1 * speciesReMatchService.searchByName(_, false, true) >> null + } void "buildTreeFromParentChildRelationships should build tree correctly"() { From 50d4752e4c3af44283398dc29ced31a4086d36e9 Mon Sep 17 00:00:00 2001 From: temi Date: Fri, 31 May 2024 07:06:09 +1000 Subject: [PATCH 3/3] #965 - adding N/A --- grails-app/conf/application.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grails-app/conf/application.groovy b/grails-app/conf/application.groovy index 3c186a923..1abd9646f 100644 --- a/grails-app/conf/application.groovy +++ b/grails-app/conf/application.groovy @@ -1490,4 +1490,4 @@ paratoo.defaultPlotLayoutViewModels = [ ] ] ] -paratoo.species.specialCases = ["Other"] +paratoo.species.specialCases = ["Other", "N/A"]