Skip to content

Commit

Permalink
Merge pull request #200 from chrisala/master
Browse files Browse the repository at this point in the history
Added the announcements report to the organisation page.
  • Loading branch information
chrisala committed Apr 10, 2015
2 parents 2fdd69f + 91e733e commit 9138752
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions grails-app/controllers/au/org/ala/merit/ReportController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,29 @@ class ReportController extends au.org.ala.fieldcapture.ReportController {

def events = []
resp?.resp?.projects.each { project ->
project.custom.details.events.each { event ->
if (event.scheduledDate || event.name) {
def announcement = [projectId: project.projectId, grantId: project.grantId, name: project.name, organisationName: project.organisationName, associatedProgram: project.associatedProgram, planStatus: project.planStatus, eventDate: event.scheduledDate, eventName: event.name, eventDescription: event.description, media: event.media]

def states = new HashSet()
def electorates = new HashSet()
project.sites.each {
if (it.extent?.geometry?.state) {
def state = it.extent?.geometry?.state
state = g.message(code:'label.'+state, default:state)
states.add(state)
}
if (it.extent?.geometry?.elect) {
def electorate = it.extent?.geometry?.elect
electorate = g.message(code:'label.'+electorate, default:electorate)
electorates.add(electorate)
if (project?.custom?.details?.events) {
project.custom.details.events.each { event ->
if (event.scheduledDate || event.name) {
def announcement = [projectId: project.projectId, grantId: project.grantId, name: project.name, organisationName: project.organisationName, associatedProgram: project.associatedProgram, planStatus: project.planStatus, eventDate: event.scheduledDate, eventName: event.name, eventDescription: event.description, media: event.media]

def states = new HashSet()
def electorates = new HashSet()
project.sites.each {
if (it.extent?.geometry?.state) {
def state = it.extent?.geometry?.state
state = g.message(code: 'label.' + state, default: state)
states.add(state)
}
if (it.extent?.geometry?.elect) {
def electorate = it.extent?.geometry?.elect
electorate = g.message(code: 'label.' + electorate, default: electorate)
electorates.add(electorate)
}
}
announcement.state = states.join(',')
announcement.electorate = electorates.join(',')
events << announcement
}
announcement.state = states.join(',')
announcement.electorate = electorates.join(',')
events << announcement
}
}
}
Expand Down

0 comments on commit 9138752

Please sign in to comment.