From 90c92a54145c9d70d7eb79fe360b638eeeef12c6 Mon Sep 17 00:00:00 2001 From: chrisala Date: Wed, 29 May 2024 12:58:51 +1000 Subject: [PATCH 1/2] Change site name based on core/fauna #942 --- .../ecodata/paratoo/ParatooProtocolConfig.groovy | 10 +++++++--- .../paratoo/ParatooProtocolConfigSpec.groovy | 16 ++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy b/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy index 98a02dba7..09f805666 100644 --- a/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy +++ b/src/main/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfig.groovy @@ -14,6 +14,8 @@ import org.locationtech.jts.geom.Geometry class ParatooProtocolConfig { static final String FAUNA_PLOT = 'Fauna plot' static final String CORE_PLOT = 'Core monitoring plot' + static final String FAUNA_PLOT_SHORT = 'Fauna' + static final String CORE_PLOT_SHORT = 'Core' String name String apiEndpoint boolean usesPlotLayout = true @@ -319,17 +321,19 @@ class ParatooProtocolConfig { Map plotSelection = getProperty(surveyData, plotSelectionPath) Map plotSelectionGeoJson = plotSelectionToGeoJson(plotSelection) - String plotLayoutDimensionLabel = getProperty(surveyData, plotLayoutDimensionLabelPath) String plotLayoutTypeLabel = getProperty(surveyData, plotLayoutTypeLabelPath) + List faunaPlotPoints = getProperty(surveyData, faunaPlotPointPath) - String name = plotSelectionGeoJson.properties.name + ' - ' + plotLayoutTypeLabel + ' (' + plotLayoutDimensionLabel + ')' + String name = plotSelectionGeoJson.properties.name + ' - ' + plotLayoutTypeLabel + ' ('+CORE_PLOT_SHORT+')' Map plotGeoJson = createFeatureFromGeoJSON(plotLayoutPoints, name, plotLayoutId, "${CORE_PLOT} ${plotSelectionGeoJson?.properties?.notes?:""}") - List faunaPlotPoints = getProperty(surveyData, faunaPlotPointPath) if (faunaPlotPoints) { + name = plotSelectionGeoJson.properties.name + ' - ' + plotLayoutTypeLabel + ' (' + FAUNA_PLOT_SHORT + ')' Map faunaPlotGeoJson = createFeatureFromGeoJSON(faunaPlotPoints, name, plotLayoutId, "${FAUNA_PLOT} ${plotSelectionGeoJson?.properties?.notes?:""}") List features = [plotGeoJson, faunaPlotGeoJson] + + name = plotSelectionGeoJson.properties.name + ' - ' + plotLayoutTypeLabel + ' (' + CORE_PLOT_SHORT + ' + ' + FAUNA_PLOT_SHORT + ')' plotGeoJson = createConvexHullGeoJSON(features, name, plotLayoutId, plotGeoJson.properties.notes) } diff --git a/src/test/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfigSpec.groovy b/src/test/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfigSpec.groovy index f42b26cf5..4a01b44e3 100644 --- a/src/test/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfigSpec.groovy +++ b/src/test/groovy/au/org/ala/ecodata/paratoo/ParatooProtocolConfigSpec.groovy @@ -140,7 +140,7 @@ class ParatooProtocolConfigSpec extends Specification { type: "Polygon", coordinates: [[[152.880694, -27.388252], [152.880651, -27.388336], [152.880518, -27.388483], [152.880389, -27.388611], [152.88028, -27.388749], [152.880154, -27.388903], [152.880835, -27.389463], [152.880644, -27.389366], [152.880525, -27.389248], [152.88035, -27.389158], [152.880195, -27.389021], [152.880195, -27.389373], [152.880797, -27.388316], [152.881448, -27.388909], [152.881503, -27.388821], [152.881422, -27.388766], [152.881263, -27.388644], [152.881107, -27.388549], [152.880939, -27.388445], [152.881314, -27.389035], [152.88122, -27.389208], [152.881089, -27.389343], [152.880973, -27.389472], [152.880916, -27.389553], [152.880694, -27.388252]]] ], - properties: [name: "QDASEQ0001 - Control (100 x 100)", externalId: "1", description: "QDASEQ0001 - Control (100 x 100)", notes: "Core monitoring plot some comment"] + properties: [name: "QDASEQ0001 - Control (Core)", externalId: "1", description: "QDASEQ0001 - Control (Core)", notes: "Core monitoring plot some comment"] ] } @@ -196,7 +196,7 @@ class ParatooProtocolConfigSpec extends Specification { coordinates:[[[138.6372, -34.9723], [138.6371, -34.9723], [138.6371, -34.9714], [138.6382, -34.9714], [138.6383, -34.9714], [138.6383, -34.9723], [138.6372, -34.9723]]], type:"Polygon" ], - properties:[name:"SATFLB0001 - Control (100 x 100)", externalId:"2", notes:"Core monitoring plot some comment", description:"SATFLB0001 - Control (100 x 100)"], + properties:[name:"SATFLB0001 - Control (Core + Fauna)", externalId:"2", notes:"Core monitoring plot some comment", description:"SATFLB0001 - Control (Core + Fauna)"], features:[ [ type:"Feature", @@ -204,7 +204,7 @@ class ParatooProtocolConfigSpec extends Specification { type:"Polygon", coordinates:[[[138.63720760798054, -34.97222197296049], [138.63720760798054, -34.97204230990367], [138.63720760798054, -34.971862646846844], [138.63720760798054, -34.97168298379002], [138.63720760798054, -34.9715033207332], [138.63720760798054, -34.971413489204785], [138.63731723494544, -34.971413489204785], [138.6375364888752, -34.971413489204785], [138.63775574280498, -34.971413489204785], [138.63797499673475, -34.971413489204785], [138.63819425066453, -34.971413489204785], [138.63830387762943, -34.971413489204785], [138.63830387762943, -34.9715033207332], [138.63830387762943, -34.97168298379002], [138.63830387762943, -34.971862646846844], [138.63830387762943, -34.97204230990367], [138.63830387762943, -34.97222197296049], [138.63830387762943, -34.9723118044889], [138.63819425066453, -34.9723118044889], [138.63797499673475, -34.9723118044889], [138.63775574280498, -34.9723118044889], [138.6375364888752, -34.9723118044889], [138.63731723494544, -34.9723118044889], [138.63720760798054, -34.9723118044889], [138.63720760798054, -34.97222197296049]]] ], - properties:[name:"SATFLB0001 - Control (100 x 100)", externalId:"2", description:"SATFLB0001 - Control (100 x 100)", notes:"Core monitoring plot some comment"]], + properties:[name:"SATFLB0001 - Control (Core)", externalId:"2", description:"SATFLB0001 - Control (Core)", notes:"Core monitoring plot some comment"]], [ type:"Feature", geometry:[ @@ -212,7 +212,7 @@ class ParatooProtocolConfigSpec extends Specification { coordinates:[[[138.6371026907952, -34.971403261821905], [138.63709732396242, -34.972304399720215], [138.6381916652405, -34.972304399720215], [138.63819166764344, -34.9714076576406], [138.6371026907952, -34.971403261821905]]] ], properties:[ - name:"SATFLB0001 - Control (100 x 100)", externalId:"2", description:"SATFLB0001 - Control (100 x 100)", notes:"Fauna plot some comment" + name:"SATFLB0001 - Control (Fauna)", externalId:"2", description:"SATFLB0001 - Control (Fauna)", notes:"Fauna plot some comment" ] ] ] @@ -225,9 +225,9 @@ class ParatooProtocolConfigSpec extends Specification { coordinates:[[[138.63720760798054, -34.97222197296049], [138.63720760798054, -34.97204230990367], [138.63720760798054, -34.971862646846844], [138.63720760798054, -34.97168298379002], [138.63720760798054, -34.9715033207332], [138.63720760798054, -34.971413489204785], [138.63731723494544, -34.971413489204785], [138.6375364888752, -34.971413489204785], [138.63775574280498, -34.971413489204785], [138.63797499673475, -34.971413489204785], [138.63819425066453, -34.971413489204785], [138.63830387762943, -34.971413489204785], [138.63830387762943, -34.9715033207332], [138.63830387762943, -34.97168298379002], [138.63830387762943, -34.971862646846844], [138.63830387762943, -34.97204230990367], [138.63830387762943, -34.97222197296049], [138.63830387762943, -34.9723118044889], [138.63819425066453, -34.9723118044889], [138.63797499673475, -34.9723118044889], [138.63775574280498, -34.9723118044889], [138.6375364888752, -34.9723118044889], [138.63731723494544, -34.9723118044889], [138.63720760798054, -34.9723118044889], [138.63720760798054, -34.97222197296049]]] ], properties:[ - name:"SATFLB0001 - Control (100 x 100)", + name:"SATFLB0001 - Control (Core)", externalId:"2", - description:"SATFLB0001 - Control (100 x 100)", + description:"SATFLB0001 - Control (Core)", notes:"Core monitoring plot some comment" ] ], @@ -238,9 +238,9 @@ class ParatooProtocolConfigSpec extends Specification { coordinates:[[[138.6371026907952, -34.971403261821905], [138.63709732396242, -34.972304399720215], [138.6381916652405, -34.972304399720215], [138.63819166764344, -34.9714076576406], [138.6371026907952, -34.971403261821905]]] ], properties:[ - name:"SATFLB0001 - Control (100 x 100)", + name:"SATFLB0001 - Control (Fauna)", externalId:"2", - description:"SATFLB0001 - Control (100 x 100)", + description:"SATFLB0001 - Control (Fauna)", notes:"Fauna plot some comment" ] ] From 74af996c0710f494d1e9950fc7394dce71e95f20 Mon Sep 17 00:00:00 2001 From: chrisala Date: Wed, 29 May 2024 13:27:02 +1000 Subject: [PATCH 2/2] Fixed test #942 --- .../au/org/ala/ecodata/ParatooServiceSpec.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy b/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy index 83f2c4f5c..23501b396 100644 --- a/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy +++ b/src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy @@ -338,8 +338,8 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest new Site( - name: "SATFLB0001 - Control (100 x 100)", + name: "SATFLB0001 - Control (Core)", siteId: "s0", extent: [geometry: DUMMY_POLYGON], - description: "SATFLB0001 - Control (100 x 100)", + description: "SATFLB0001 - Control (Core)", notes: "Core monitoring plot some comment", type: "compound", externalIds: [new ExternalId(externalId: "2", idType: ExternalId.IdType.MONITOR_PLOT_GUID)],