Skip to content

Commit

Permalink
Don't return plot layouts from /user-projects #823
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Mar 20, 2024
1 parent 978a4c8 commit 5bb929e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion grails-app/services/au/org/ala/ecodata/ParatooService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ class ParatooService {
projectAreaGeoJson = siteService.geometryAsGeoJson(projectArea)
}

List<Site> plotSelections = sites.findAll{it.type == Site.TYPE_SURVEY_AREA}
// Monitor has users selecting a point as an approximate survey location then
// laying out the plot using GPS when at the site. We only want to return the approximate planning
// sites from this call
List<Site> plotSelections = sites.findAll{it.type == Site.TYPE_SURVEY_AREA && it.extent?.geometry?.type == 'Point'}

Map attributes = [
id:project.projectId,
Expand Down
5 changes: 3 additions & 2 deletions src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
ActivityService activityService = Mock(ActivityService)

static Map DUMMY_POLYGON = [type:'Polygon', coordinates: [[[1,2], [2,2], [2, 1], [1,1], [1,2]]]]
static Map DUMMY_PLOT = ['type':'Point', coordinates: [1,2]]

def setup() {

Expand Down Expand Up @@ -234,7 +235,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
"lng": 138.59973907470706
]
]]
Map expectedSite = [name:"Monitor project area", type:Site.TYPE_PROJECT_AREA, projects:[projectId],
Map expectedSite = [name:"Monitor Project Extent", type:Site.TYPE_PROJECT_AREA, projects:[projectId],
extent:[source:"drawn", geometry: [type:'Polygon', coordinates:[[[138.6845397949219, -34.96643621094802], [138.66394042968753, -35.003565839769166], [138.59973907470706, -34.955744257334246], [138.6845397949219, -34.96643621094802]]]]]]

when:
Expand Down Expand Up @@ -306,7 +307,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer

Site projectArea = new Site(siteId:'s1', name:'Site 1', type:Site.TYPE_PROJECT_AREA, extent: [geometry:DUMMY_POLYGON])
projectArea.save(failOnError:true, flush:true)
Site plot = new Site(siteId:'s2', name:"Site 2", type:Site.TYPE_SURVEY_AREA, extent: [geometry:DUMMY_POLYGON], projects:['p1'])
Site plot = new Site(siteId:'s2', name:"Site 2", type:Site.TYPE_SURVEY_AREA, extent: [geometry:DUMMY_PLOT], projects:['p1'])
plot.save(failOnError:true, flush:true)
siteService.sitesForProjectWithTypes('p1', [Site.TYPE_PROJECT_AREA, Site.TYPE_SURVEY_AREA]) >> [projectArea, plot]

Expand Down

0 comments on commit 5bb929e

Please sign in to comment.