Skip to content

Commit

Permalink
Merge pull request #1073 from AtlasOfLivingAustralia/feature/issue3451
Browse files Browse the repository at this point in the history
Exclude externally created activities from default project query #3451
  • Loading branch information
temi authored Feb 20, 2025
2 parents 74b38b6 + e2c9eb7 commit 1b882aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions grails-app/services/au/org/ala/ecodata/ActivityService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,20 @@ class ActivityService {
}
}

List findAllForProjectId(id, levelOfDetail = [], includeDeleted = false) {
List findAllForProjectId(id, levelOfDetail = [], includeDeleted = false, includeExternalActivities = false) {
List activities
if (includeDeleted) {
activities = Activity.findAllByProjectId(id).collect {toMap(it, levelOfDetail)}
}
else {
else if (includeExternalActivities) {
activities = Activity.findAllByProjectIdAndStatus(id, ACTIVE).collect { toMap(it, levelOfDetail) }
}
else {
// By specifying externalIds:null we are excluding Monitor activities from the search as they can't
// contribute to the output scores and for some projects there are a lot of them and they can have
// a very large amount of data associated with them.
activities = Activity.findAllByProjectIdAndStatusAndExternalIds(id, ACTIVE, null).collect { toMap(it, levelOfDetail) }
}
activities
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,9 +1146,9 @@ class ElasticSearchService {
site.remove('geoIndex')
site
}
projectMap.activities = activityService.findAllForProjectId(project.projectId, LevelOfDetail.NO_OUTPUTS.name())
projectMap.activities = activityService.findAllForProjectId(project.projectId, LevelOfDetail.NO_OUTPUTS.name(), false, true)
} else {
projectMap.activities = activityService.findAllForProjectId(project.projectId, LevelOfDetail.NO_OUTPUTS.name()).collect{[type:it.type]}
projectMap.activities = activityService.findAllForProjectId(project.projectId, LevelOfDetail.NO_OUTPUTS.name(), false, true).collect{[type:it.type]}
}

// If we don't flatten these values into the root of the project, they are not currently usable by
Expand Down

0 comments on commit 1b882aa

Please sign in to comment.