Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 - renamed autoStateFacet to projectStateFacet and autoElectFacet to projectElectFacet
 - add geographic info parameters to ProjectService.toMap
  • Loading branch information
temi committed Feb 6, 2025
1 parent 84dee38 commit a0f6983
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions grails-app/conf/data/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@
"services": {
"type": "keyword"
},
"autoElectFacet": {
"projectElectFacet": {
"type": "keyword"
},
"autoStateFacet": {
"projectStateFacet": {
"type": "keyword"
},
"extent":{
Expand Down
16 changes: 9 additions & 7 deletions grails-app/services/au/org/ala/ecodata/ProjectService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ class ProjectService {
mapOfProperties.sites = siteService.findAllForProjectId(project.projectId, [SiteService.FLAT], version)
}

// add geographic info attributes such as primarystate, otherstate, primaryelect and otherelect
mapOfProperties << findAndFormatStatesAndElectoratesForProject(mapOfProperties)
mapOfProperties.documents = documentService.findAllForProjectId(project.projectId, levelOfDetail, version)
mapOfProperties.links = documentService.findAllLinksForProjectId(project.projectId, levelOfDetail, version)
Lock lock = lockService.get(project.projectId)
Expand Down Expand Up @@ -1254,8 +1256,8 @@ class ProjectService {
return [:]
}

List elect = result.remove('autoElectFacet') as List
List state = result.remove('autoStateFacet') as List
List elect = result.remove('projectElectFacet') as List
List state = result.remove('projectStateFacet') as List

if (state) {
result["primarystate"] = state.pop()
Expand Down Expand Up @@ -1293,7 +1295,7 @@ class ProjectService {
if (facetName.name) {
List intersectionValues = intersections[layer]
if (intersectionValues) {
result["auto${facetName.name.capitalize()}Facet"] = intersectionValues
result["project${facetName.name.capitalize()}Facet"] = intersectionValues
}
}
else
Expand All @@ -1304,12 +1306,12 @@ class ProjectService {
//isDefault is true or false and no sites.
if (geographicInfo) {
// load from manually assigned electorates/states
if (!result.containsKey("autoElectFacet")) {
result["autoElectFacet"] = (geographicInfo.primaryElectorate ? [geographicInfo.primaryElectorate] : []) + geographicInfo.otherElectorates
if (!result.containsKey("projectElectFacet")) {
result["projectElectFacet"] = (geographicInfo.primaryElectorate ? [geographicInfo.primaryElectorate] : []) + geographicInfo.otherElectorates
}

if (!result.containsKey("autoStateFacet")) {
result["autoStateFacet"] = (geographicInfo.primaryState ? [geographicInfo.primaryState] : []) + geographicInfo.otherStates
if (!result.containsKey("projectStateFacet")) {
result["projectStateFacet"] = (geographicInfo.primaryState ? [geographicInfo.primaryState] : []) + geographicInfo.otherStates
}
}

Expand Down

0 comments on commit a0f6983

Please sign in to comment.