Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/issue3369' into feature/…
Browse files Browse the repository at this point in the history
…issue3369
  • Loading branch information
temi committed Dec 10, 2024
2 parents 76f899c + df6d1eb commit b60c632
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ class ProjectController {
model.details.meriPlanTemplate = config.meriPlanTemplate ? config.meriPlanTemplate+"View" : RLP_MERI_PLAN_TEMPLATE+'View'

boolean serviceDeliveryVisible = model.dashboard.visible && userHasViewAccess
model.serviceDelivery = [label: 'Dashboard', visible: serviceDeliveryVisible, type: 'tab', template: 'rlpServiceDashboard', includeInvoiced:config.supportsOutcomeTargets()]
boolean showDashboardInvoiceField = (config.showsDashboardInvoiceField == null) ? config.supportsOutcomeTargets() : config.showsDashboardInvoiceField
model.serviceDelivery = [label: 'Dashboard', visible: serviceDeliveryVisible, type: 'tab', template: 'rlpServiceDashboard', includeInvoiced:showDashboardInvoiceField]
if (model.serviceDelivery.visible) {
// This can be a slow call so don't make it if the data won't be displayed
model.serviceDelivery.servicesDashboard = projectService.getServiceDashboardData(project.projectId, false)
Expand Down
3 changes: 3 additions & 0 deletions src/main/groovy/au/org/ala/merit/config/ProgramConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ class ProgramConfig implements Map {
template != null
}

/** This flag controls whether the invoice field in the dashboard is shown */
boolean showsDashboardInvoiceField = true

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ class RegionalCapacityServicesReportLifecycleListener extends ReportLifecycleLis
Map getContextData(Map organisation, Map report) {
List outputTargets = organisation.custom?.details?.services?.targets
Map periodTargets = getTargetsForReportPeriod(report, outputTargets)
BigDecimal funding = new BigDecimal(0) // TODO get budget from the correct period of the budget table
def funding = getFundingForPeriod(organisation, report)
[periodTargets:periodTargets, totalContractValue:funding]
}

private static def getFundingForPeriod(Map organisation, Map report) {
String endDate = report.toDate
String previousPeriod = ''
def index = organisation.custom?.details?.funding?.headers?.findIndexOf {
String period = it.data.value
boolean result = previousPeriod < endDate && period >= endDate
previousPeriod = period
result
}
index >= 0 ? organisation.custom?.details?.funding?.rows[0].costs[index].dollar : 0

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ class ReportLifecycleListener {
String name = scoreName(scoreId) ?: scoreId
String previousPeriod = ''
Map matchingPeriodTarget = outputTarget?.periodTargets?.find { Map periodTarget ->
previousPeriod < endDate && periodTarget.period >= endDate
boolean result = previousPeriod < endDate && periodTarget.period >= endDate
previousPeriod = periodTarget.period
result
}
[(name): matchingPeriodTarget?.target]
}
Expand Down

0 comments on commit b60c632

Please sign in to comment.