Skip to content

Commit

Permalink
Add Atlas count
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbov committed Sep 27, 2024
1 parent 4885539 commit 4d7f267
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package au.org.ala.collectory
import au.org.ala.collectory.resources.DataSourceLoad
import au.org.ala.collectory.resources.gbif.GbifDataSourceAdapter
import au.org.ala.collectory.resources.gbif.GbifRepatDataSourceAdapter
import groovy.json.JsonSlurper

class ManageController {

Expand Down Expand Up @@ -96,15 +97,19 @@ class ManageController {
// TODO: stream?
def result = []
dataResources.each { dr ->
def atlasCountUrl = grailsApplication.config.biocacheServicesUrl +
"/occurrences/search?pageSize=0&fq=data_resource_uid:" + dr.uid
def atlasCountJson = new JsonSlurper().parse(new URL(atlasCountUrl))

def item = [
title: dr.name,
uid: dr.uid,
gbifKey: dr.gbifRegistryKey,
type: dr.resourceType,
repatriationCountry: dr.repatriationCountry,
gbifPublished: "-",
gbifCount: "-",
atlasCount: 0,
gbifCount: 0,
atlasCount: atlasCountJson.totalRecords,
atlasPublished: dr.dataCurrency
]
result.add(item)
Expand Down
8 changes: 6 additions & 2 deletions grails-app/views/manage/gbifCompare.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
<td>${item.repatriationCountry}</td>
<td>${item.gbifPublished}</td>
<td>${item.atlasPublished}</td>
<td>${item.gbifCount}</td>
<td>${item.atlasCount}</td>
<td style="text-align: right;">
<g:formatNumber number="${item.gbifCount}" format="###,###,##0" />
</td>
<td style="text-align: right;">
<g:formatNumber number="${item.atlasCount}" format="###,###,##0" />
</td>
</tr>
</g:each>
</table>
Expand Down

0 comments on commit 4d7f267

Please sign in to comment.