From 74938e36eabd051e407124ec8915ac6aea9d1263 Mon Sep 17 00:00:00 2001 From: temi Date: Tue, 3 Dec 2024 18:01:02 +1100 Subject: [PATCH] - reverting to old code so that sites not in project activity list can be displayed. --- grails-app/assets/javascripts/viewModels.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/grails-app/assets/javascripts/viewModels.js b/grails-app/assets/javascripts/viewModels.js index d5b6e32..e277a56 100644 --- a/grails-app/assets/javascripts/viewModels.js +++ b/grails-app/assets/javascripts/viewModels.js @@ -515,7 +515,20 @@ function enmapify(args) { })[0]; //search from site collection in case it is a private site if (!matchingSite) { - offlineGetSiteAndAddToSiteList(siteId) + fetchSite(siteId).done(function (result) { + if (result.data) { + var site = result.data; + site.name='Location of the sighting'; + sitesObservable.push(site); + matchingSite = site; + map.clearBoundLimits(); + map.setGeoJSON(Biocollect.MapUtilities.featureToValidGeoJson(matchingSite.extent.geometry)); + // Reassign since siteIdObservable value is cleared when the site is not listed in sitesObservable. + siteIdObservable(siteId); + } + }).fail(function(result) { + console.log(result.message); + }); } // TODO: OPTIMISE THE PROCEDUE