Index: grails-app/services/com/lemans/ds/solr/SolrQueryService.groovy =================================================================== diff -u -r9a653acc65d6d2cb2ee1d988eecc4de1f71187a7 -rd8eac959a455a3721c05140af8bfa253e1326569 --- grails-app/services/com/lemans/ds/solr/SolrQueryService.groovy (.../SolrQueryService.groovy) (revision 9a653acc65d6d2cb2ee1d988eecc4de1f71187a7) +++ grails-app/services/com/lemans/ds/solr/SolrQueryService.groovy (.../SolrQueryService.groovy) (revision d8eac959a455a3721c05140af8bfa253e1326569) @@ -692,22 +692,20 @@ SimpleOrderedMap uniqueVals = facets ? facets.get('uniqueVals') : [:] SimpleOrderedMap missing = uniqueVals?.get('missing') List buckets = uniqueVals?.get('buckets') - List values = populateCardinalityValuesForDate(buckets, missing, payload) - println values - Optional> optionalResult = values.stream() - .max{ obj1, obj2 -> - if (obj1.date == null && obj2.date == null) { + Optional> optionalResult = values?.stream() + ?.max{ obj1, obj2 -> + if (obj1?.date == null && obj2?.date == null) { return 0 - } else if (obj1.date == null) { + } else if (obj1?.date == null) { return 1 - } else if (obj2.date == null) { + } else if (obj2?.date == null) { return -1 } else { - return obj1.date.compareTo(obj2.date) + return obj1?.date.compareTo(obj2?.date) } - }.orElse(null) - Date totalDate = optionalResult.isPresent() ? optionalResult.get()['date'] : null + }?.orElse(null) + Date totalDate = optionalResult?.isPresent() ? optionalResult?.get()['date'] : null [type: payload.queueType.name(), displayName: payload.queueType.value, drillDowns: values ?: [], date: totalDate] }