Skip to content

Commit

Permalink
Merge pull request #964 from AtlasOfLivingAustralia/feature/issue942
Browse files Browse the repository at this point in the history
Change site name based on core/fauna #942
  • Loading branch information
chrisala authored May 29, 2024
2 parents d216915 + 74af996 commit 49a9500
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
12 changes: 6 additions & 6 deletions src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
1 * userService.setCurrentUser(userId)

and:
site.name == "SATFLB0001 - Control (100 x 100)"
site.description == "SATFLB0001 - Control (100 x 100)"
site.name == "SATFLB0001 - Control (Core + Fauna)"
site.description == "SATFLB0001 - Control (Core + Fauna)"
site.notes == "Core monitoring plot some comment"
site.type == "compound"
site.publicationStatus == "published"
Expand All @@ -357,10 +357,10 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
Date afterSubmissionDate = DateUtil.parseWithMilliseconds("2023-09-15T06:00:11.996Z")
Date beforeSubmissionDate = DateUtil.parseWithMilliseconds("2023-09-14T06:00:11.996Z")
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)],
Expand Down Expand Up @@ -420,10 +420,10 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
Date beforeSubmissionDate = DateUtil.parseWithMilliseconds("2023-09-14T06:00:11.996Z")
Site.withSession { session ->
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)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
]
}

Expand Down Expand Up @@ -196,23 +196,23 @@ 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",
geometry:[
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:[
type:"Polygon",
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"
]
]
]
Expand All @@ -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"
]
],
Expand All @@ -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"
]
]
Expand Down

0 comments on commit 49a9500

Please sign in to comment.