Skip to content

Commit

Permalink
Merge pull request #526 from AtlasOfLivingAustralia/dev
Browse files Browse the repository at this point in the history
Preparing v1.45
  • Loading branch information
chrisala authored Mar 25, 2019
2 parents 4b72372 + 511f223 commit 93cb2f5
Show file tree
Hide file tree
Showing 30 changed files with 2,771 additions and 1,284 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language: groovy
sudo: false
jdk:
- openjdk7
- openjdk8
branches:
only:
- master
- dev
- grails_2_5_6

services:
- mongodb
Expand Down
4 changes: 2 additions & 2 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Grails Metadata file
#Tue Oct 30 15:43:18 AEDT 2018
app.grails.version=2.4.5
app.grails.version=2.5.6
app.name=ecodata
app.version=1.44.1
app.version=1.45-SNAPSHOT
10 changes: 10 additions & 0 deletions grails-app/conf/BootStrap.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import au.org.ala.ecodata.AccessLevel
import au.org.ala.ecodata.AuditEventType
import au.org.ala.ecodata.GormEventListener
import au.org.ala.ecodata.Hub
import au.org.ala.ecodata.Program
import grails.converters.JSON
import groovy.json.JsonSlurper
import net.sf.json.JSONNull
import org.bson.BSON
import org.bson.Transformer
Expand All @@ -18,6 +20,7 @@ class BootStrap {
def elasticSearchService
def grailsApplication
def auditService
def hubService

def init = { servletContext ->
// Add custom GORM event listener for ES indexing
Expand Down Expand Up @@ -73,6 +76,13 @@ class BootStrap {

JSON.registerObjectMarshaller(JSONNull, {return ""})

// Setup the default ALA hub if necessary as BioCollect won't load without it.
Hub alaHub = Hub.findByUrlPath('ala')
if (!alaHub) {
Map alaHubData = new JsonSlurper().parseText(getClass().getResourceAsStream("/data/alaHub.json").getText())
hubService.create(alaHubData)
}

//Add a default project for individual sightings (unless disabled)
def individualSightingsProject = au.org.ala.ecodata.Project.findByProjectId(grailsApplication.config.records.default.projectId)
if(!individualSightingsProject){
Expand Down
2 changes: 2 additions & 0 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ grails.project.dependency.resolution = {
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'

compile 'org.mongodb:mongo-java-driver:2.12.3'

compile 'com.twelvemonkeys.imageio:imageio-jpeg:3.3.2'

runtime "javax.transaction:jta:1.1" // Required as a side effect of ehcache field walking.
Expand Down
2 changes: 1 addition & 1 deletion grails-app/conf/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class UrlMappings {
"/ws/$controller/findByName"{ action = [GET:"findByName"] }


"/"(view:"/index")
"/"(redirect:[controller:"documentation"])
"500"(view:'/error')
}
}
268 changes: 268 additions & 0 deletions grails-app/conf/data/alaHub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
{
"adminFacets": [],
"availableFacets": [
"status",
"organisationFacet"
],
"availableMapFacets": [
"status",
"organisationFacet"
],
"bannerUrl": "",
"content": {
"hideBreadCrumbs": false,
"hideCancelButtonOnForm": false,
"showNote": false,
"hideProjectAndSurvey": false,
"industries": false,
"isContainer": false,
"recordNote": ""
},
"customBreadCrumbs": [],
"defaultFacetQuery": [
"isCitizenScience:true"
],
"defaultProgram": "Citizen Science Projects",
"homePageControllerAndAction": {
"controller": "project",
"action": "citizenScience"
},
"logoUrl": "",
"pages": {
"allRecords": {
"facets": [
{
"isNotHistogram": true,
"helpText": "Name of the project",
"facetTermType": "Default",
"formattedName": "Project (projectNameFacet)",
"name": "projectNameFacet",
"interval": 10,
"state": "Expanded",
"title": "Project"
},
{
"isNotHistogram": true,
"helpText": "Name of survey",
"facetTermType": "Default",
"formattedName": "Survey name (projectActivityNameFacet)",
"name": "projectActivityNameFacet",
"interval": 10,
"state": "Expanded",
"title": "Survey name"
},
{
"isNotHistogram": true,
"helpText": "Organisations either running projects or associated with projects (eg. as partners).",
"facetTermType": "Default",
"formattedName": "Organisation (organisationNameFacet)",
"name": "organisationNameFacet",
"interval": 10,
"state": "Expanded",
"title": "Organisation"
},
{
"isNotHistogram": true,
"helpText": "Sighting's scientific name",
"facetTermType": "Default",
"formattedName": "Species name (recordNameFacet)",
"name": "recordNameFacet",
"interval": 10,
"state": "Expanded",
"title": "Species name"
},
{
"isNotHistogram": true,
"helpText": "User who created the record",
"facetTermType": "Default",
"formattedName": "Owner (userId)",
"name": "userId",
"interval": 10,
"state": "Expanded",
"title": "Owner"
},
{
"isNotHistogram": true,
"helpText": "Month the sighting was observed",
"facetTermType": "Default",
"formattedName": "Month (surveyMonthFacet)",
"name": "surveyMonthFacet",
"interval": 10,
"state": "Expanded",
"title": "Month"
},
{
"isNotHistogram": true,
"helpText": "Year the sighting was observed",
"facetTermType": "Default",
"formattedName": "Year (surveyYearFacet)",
"name": "surveyYearFacet",
"interval": 10,
"state": "Expanded",
"title": "Year"
}
]
},
"userProjectActivityRecords": {
"facets": []
},
"myRecords": {
"facets": []
},
"project": {
"facets": []
},
"projectFinder": {
"facets": [
{
"isNotHistogram": true,
"helpText": "Active projects are still running, whereas 'completed' projects have ended and are no longer 'active'",
"facetTermType": "Default",
"formattedName": "Status (status)",
"name": "status",
"interval": 10,
"state": "Collapsed",
"title": "Status"
},
{
"isNotHistogram": true,
"helpText": "Classifications for citizen science projects to assist decision making for participation",
"facetTermType": "Default",
"formattedName": "Tags (tags)",
"name": "tags",
"interval": 10,
"state": "Expanded",
"title": "Tags"
},
{
"isNotHistogram": true,
"helpText": "A general level of difficulty for citizen science participation",
"facetTermType": "Default",
"formattedName": "Difficulty (difficulty)",
"name": "difficulty",
"interval": 10,
"state": "Expanded",
"title": "Difficulty"
},
{
"isNotHistogram": true,
"helpText": "Categories of science which survey-based projects are addressing.",
"facetTermType": "Default",
"formattedName": "Science Type (scienceType)",
"name": "scienceType",
"interval": 10,
"state": "Collapsed",
"title": "Science Type"
},
{
"isNotHistogram": true,
"helpText": "Countries in which people can participate in the project.",
"facetTermType": "Default",
"formattedName": "Countries (countries)",
"name": "countries",
"interval": 10,
"state": "Collapsed",
"title": "Countries"
},
{
"isNotHistogram": true,
"helpText": "The continental regions in which projects occur according to the United Nations regional classification scheme.",
"facetTermType": "Default",
"formattedName": "UN Regions (uNRegions)",
"name": "uNRegions",
"interval": 10,
"state": "Collapsed",
"title": "UN Regions"
},
{
"isNotHistogram": true,
"helpText": "The project catalogue system in which the project is registered.",
"facetTermType": "Default",
"formattedName": "Source System (origin)",
"name": "origin",
"interval": 10,
"state": "Collapsed",
"title": "Source System"
},
{
"isNotHistogram": true,
"helpText": "Name of the project",
"facetTermType": "Default",
"formattedName": "Contributing Data to ALA (isExternal)",
"name": "isExternal",
"interval": 10,
"state": "Collapsed",
"title": "Contributing Data to ALA"
}
]
},
"projectRecords": {
"facets": []
},
"myProjectRecords": {
"facets": []
}
},
"quickLinks": [],
"skin": "ala2",
"status": "active",
"supportedPrograms": [
"Citizen Science Projects",
"None"
],
"templateConfiguration": {
"footer": {
"links": [],
"socials": [],
"type": ""
},
"header": {
"links": [],
"type": ""
},
"banner": {
"transitionSpeed": 4000,
"images": []
},
"styles": {
"bannerBackgroundColor": "#323334",
"titleTextColor": "#5f5d60",
"bodyBackgroundColor": "#ffffff",
"facetBackgroundColor": "#f5f5f5",
"defaultButtonTextColor": "#000",
"defaultButtonColorActive": "#fff",
"tileBackgroundColor": "#f5f5f5",
"defaultButtonBackgroundColor": "#f5f5f5",
"menuTextColor": "#efefef",
"primaryButtonBackgroundColor": "#009080",
"defaultButtonBackgroundColorActive": "#000",
"wellBackgroundColor": "#f5f5f5",
"navBackgroundColor": "#e5e6e7",
"headerBannerBackgroundColor": "#ffffff",
"hrefColor": "#009080",
"footerBackgroundColor": "#323334",
"breadCrumbBackGroundColour": "",
"navTextColor": "#5f5d60",
"primaryButtonTextColor": "#fff",
"insetTextColor": "",
"menuBackgroundColor": "#009080",
"footerTextColor": "#efefef",
"bodyTextColor": "#637073",
"socialTextColor": "#000",
"insetBackgroundColor": ""
},
"homePage": {
"homePageConfig": "projectfinder",
"buttonsConfig": {
"buttons": [],
"numberOfColumns": "3"
},
"projectFinderConfig": {
"defaultView": "grid",
"showProjectRegionSwitch": false
}
}
},
"title": "BioCollect",
"urlPath": "ala"
}
33 changes: 28 additions & 5 deletions grails-app/controllers/au/org/ala/ecodata/ProjectController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,38 @@ class ProjectController {

def projectMetrics(String id) {

// TODO this is temporarily hardcoded, but we can maybe define a meta model for reporting
// Need to add targets to this also.
def p = Project.findByProjectId(id)

boolean approvedOnly = params.getBoolean('approvedOnly')
List scoreIds = params.getList('scoreIds')
boolean approvedOnly = true
boolean targetsOnly = false
boolean includeTargets = true
List scoreIds
Map aggregationConfig = null

Map paramData = request.JSON
if (!paramData) {
approvedOnly = params.getBoolean('approvedOnly')
scoreIds = params.getList('scoreIds')
targetsOnly = params.getBoolean('targetsOnly')
includeTargets = params.getBoolean('includeTargets', true)
}
else {

if (paramData.approvedOnly != null) {
approvedOnly = paramData.approvedOnly
}
if (paramData.targetsOnly != null) {
approvedOnly = paramData.targetsOnly
}
if (paramData.includeTargets != null) {
includeTargets = paramData.includeTargets
}
scoreIds = paramData.scoreIds
aggregationConfig = paramData.aggregationConfig
}

if (p) {
render projectService.projectMetrics(id, false, approvedOnly, scoreIds) as JSON
render projectService.projectMetrics(id, targetsOnly, approvedOnly, scoreIds, aggregationConfig, includeTargets) as JSON

} else {
render (status: 404, text: 'No such id')
Expand Down
Loading

0 comments on commit 93cb2f5

Please sign in to comment.