From 0bfbcdb0a29be38a79290228973c61f97ee82965 Mon Sep 17 00:00:00 2001 From: chrisala Date: Tue, 6 Feb 2024 15:29:23 +1100 Subject: [PATCH] Allow protocol sync to rewrite paratoo internal ids #823 --- grails-app/services/au/org/ala/ecodata/ParatooService.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy index 1de22cbd1..e390bcf42 100644 --- a/grails-app/services/au/org/ala/ecodata/ParatooService.groovy +++ b/grails-app/services/au/org/ala/ecodata/ParatooService.groovy @@ -288,11 +288,12 @@ class ParatooService { log.info message } else { - String message = "Updating form with id: "+id+", guid: "+guid+", name: "+name+", new id: "+id + ExternalId paratooInternalId = form.externalIds.find{it.idType == ExternalId.IdType.MONITOR_PROTOCOL_INTERNAL_ID} + // Paratoo internal protocol ids are not stable so if we match the guid, we may need to update // the id as that is used in other API methods. - ExternalId paratooInternalId = form.externalIds.find{it.idType == ExternalId.IdType.MONITOR_PROTOCOL_INTERNAL_ID} if (paratooInternalId) { + String message = "Updating form with id: "+paratooInternalId.externalId+", guid: "+guid+", name: "+name+", new id: "+id paratooInternalId.externalId = id } else {