AtlasOfLivingAustralia / volunteer-portal

DigiVol (Biodiversity Volunteer Portal)
https://volunteer.ala.org.au
17 stars 15 forks source link

Cacheable annotation no longer allows groovy null check #556

Closed cdausmus closed 2 years ago

cdausmus commented 2 years ago

Found when testing stats for institution admin, null pointer exceptions thrown when null value for institution was used. The Groovy null check operator ? no longer works in the Cacheable annotation:

@Cacheable(value = 'StatsTranscriptionTime', key = { "${institution?.id?.toString() ?: '-1'}-${startDate?.getTime() ?: '-1'}-${endDate?.getTime() ?: '-1'}" }) def getTranscriptionTimeByProjectType(Date startDate, Date endDate, Institution institution) {}

Needs to be updated to check for nulls the long way: "${(institution ? institution.id.toString() : '-1')}"

Testing check: