From 4986aff8a879e6d93a3953000642b113aae17525 Mon Sep 17 00:00:00 2001 From: Mats Bovin Date: Wed, 27 Mar 2024 13:02:36 +0100 Subject: [PATCH] Add filter for showing only unsynced datasets --- .../org/ala/collectory/IptController.groovy | 9 ++++++-- grails-app/views/ipt/syncView.gsp | 23 +++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/grails-app/controllers/au/org/ala/collectory/IptController.groovy b/grails-app/controllers/au/org/ala/collectory/IptController.groovy index 062a6d31..dfaed453 100644 --- a/grails-app/controllers/au/org/ala/collectory/IptController.groovy +++ b/grails-app/controllers/au/org/ala/collectory/IptController.groovy @@ -232,12 +232,13 @@ class IptController { def provider = providerGroupService._get(params.uid) def sortBy = params.sort ?: "title" def sortDirection = params.order ?: "asc" + def onlyUnsynced = Boolean.parseBoolean(params.onlyUnsynced ?: "false") def result = [] if (provider.websiteUrl) { def dataResourceMap = [:] - DataResource.findAll({ it.gbifRegistryKey }).each { dr -> + DataResource.findAll { it.gbifRegistryKey }.each { dr -> dataResourceMap.put(dr.gbifRegistryKey, dr) } @@ -267,12 +268,16 @@ class IptController { result.add(row) } + if (onlyUnsynced) { + result = result.findAll { it.iptCount != it.atlasCount || it.iptPublished != it.atlasPublished } + } + result.sort { it[sortBy] } if (sortDirection == "desc") { result = result.reverse() } } - [result: result, instance: provider, sortBy: sortBy, sortDirection: sortDirection] + [result: result, instance: provider, sortBy: sortBy, sortDirection: sortDirection, onlyUnsynced: onlyUnsynced] } } diff --git a/grails-app/views/ipt/syncView.gsp b/grails-app/views/ipt/syncView.gsp index 33213866..d343ff23 100644 --- a/grails-app/views/ipt/syncView.gsp +++ b/grails-app/views/ipt/syncView.gsp @@ -14,28 +14,31 @@

${instance.name} vs Atlas

- + + Show allonly unsynced datasets + +
@@ -51,13 +54,13 @@ - -
- Title + Title - Uid + Uid - Type + Type - IPT published + IPT published - Atlas published + Atlas published - IPT record count + IPT record count - Atlas record count + Atlas record count
${item.type} + color: green"> ${item.iptPublished} color: red"> ${item.atlasPublished} + color: green"> color: red">