Skip to content

Commit 843d337

Browse files
authored
Merge pull request #844 from AtlasOfLivingAustralia/hotfix/4.2.1
added fathom analytics site id and collectory fix
2 parents 8cda54c + 06ba684 commit 843d337

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins {
2222
id 'jacoco'
2323
}
2424

25-
version "4.2"
25+
version "4.2.1-SNAPSHOT"
2626
group "au.org.ala"
2727
description "Ecodata"
2828

grails-app/domain/au/org/ala/ecodata/Hub.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class Hub {
6464
/** The URL prefix to use when creating a URL a user can use to download a report */
6565
String downloadUrlPrefix
6666

67+
/** Fathom analytics site id for hub specific analytics. If not specified, BioCollect will use the default site id. */
68+
String fathomSiteId
69+
6770
AccessManagementOptions accessManagementOptions
6871

6972
static mapping = {
@@ -89,6 +92,7 @@ class Hub {
8992
emailReplyToAddress nullable: true
9093
downloadUrlPrefix nullable: true
9194
accessManagementOptions nullable: true
95+
fathomSiteId nullable: true
9296
}
9397

9498
static embedded = ['mapLayersConfig', 'accessManagementOptions']

grails-app/services/au/org/ala/ecodata/CollectoryService.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ class CollectoryService {
184184
}
185185
}
186186
}
187-
else if (project.dataResourceId) {
188-
// clear dataResourceId field
189-
projectService.update([dataResourceId: null, dataProviderId: null], project.projectId, false)
190-
}
191187
}
192188

193189
def updateCollectoryEntryForProjects (Boolean isBiocollect) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
var programs = ["Land Environmental Assessment Data","Department of Water and Environmental Regulation","Environmental Protection Authority","Department of Mines, Industry Regulation and Safety"];
4+
db.project.find({associatedProgram: {$in: programs}, status: "active"}).forEach(function(project) {
5+
6+
});
7+
8+
var projects = db.project.distinct('projectId', {associatedProgram: {$in: programs}, status:{$ne:'deleted'}});
9+
print("Project id,Project name,Organisation,Document id,Title,Description,Document type,File size,Content type,URL");
10+
db.document.find({projectId: {$in: projects}, "public": true, status:{$ne:'deleted'}}).forEach(function(document) {
11+
var project = db.project.find({projectId: document.projectId}).next();
12+
var path = document.filepath ? document.filepath + "/" : "";
13+
var url = "https://biocollect.ala.org.au/document/download/" + path + encodeURIComponent(document.filename);
14+
print(document.projectId + ",\"" + project.name.replace('"', '""') + "\",\"" + project.organisationName.replace('"', '""') + "\"," + document.documentId + "," + document.name + ",\"" + (document.description || "").replace('"', '""') + "\"," + document.type + "," + document.filesize + "," + document.contentType + "," + url);
15+
});

src/test/groovy/au/org/ala/ecodata/CollectoryServiceSpec.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package au.org.ala.ecodata
22

33
import grails.converters.JSON
4-
import grails.testing.gorm.DataTest
54
import grails.testing.services.ServiceUnitTest
65
import org.grails.web.converters.marshaller.json.CollectionMarshaller
76
import org.grails.web.converters.marshaller.json.MapMarshaller
@@ -148,7 +147,7 @@ class CollectoryServiceSpec extends Specification implements ServiceUnitTest<Col
148147

149148
}
150149

151-
void "if previously harvested project is disabled, its dataResourceId should be cleared"() {
150+
void "if previously harvested project is disabled, its dataResourceId should not be cleared"() {
152151
setup:
153152
String dataResourceId = 'dr1234'
154153
String projectId = '1234'
@@ -159,7 +158,7 @@ class CollectoryServiceSpec extends Specification implements ServiceUnitTest<Col
159158

160159
then:
161160
0 * webServiceMock.doPost(_, _)
162-
1 * projectService.update(['dataResourceId':null, 'dataProviderId':null], projectId, false)
161+
0 * projectService.update(_, _, _)
163162
}
164163

165164

src/test/groovy/au/org/ala/ecodata/HubServiceSpec.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ class HubServiceSpec extends MongoSpec implements ServiceUnitTest<HubService>, D
99

1010
PermissionService permissionService = Mock(PermissionService)
1111
CommonService commonService = Stub(CommonService)
12-
Hub hub = new Hub(urlPath:'test', hubId:'id', status:'active')
12+
Hub hub = new Hub(urlPath:'test', hubId:'id', status:'active', fathomSiteId: '123')
1313

1414
void setup() {
1515
service.permissionService = permissionService
1616
service.commonService = commonService
17-
commonService.toBareMap(_) >> {args -> [urlPath:args[0].urlPath, hubId:args[0].hubId, status:args[0].status]}
17+
commonService.toBareMap(_) >> {args -> [urlPath:args[0].urlPath, hubId:args[0].hubId, status:args[0].status, fathomSiteId: args[0].fathomSiteId]}
1818

1919
Hub.findAll().each{it.delete(flush:true)}
2020
hub.save(failOnError:true, flush:true)
@@ -33,6 +33,7 @@ class HubServiceSpec extends MongoSpec implements ServiceUnitTest<HubService>, D
3333
then:
3434
result.urlPath == path
3535
result.hubId == hub.hubId
36+
result.fathomSiteId == hub.fathomSiteId
3637
}
3738

3839
void "hub permissions will be returned when a hub is queried by URL path"() {

0 commit comments

Comments
 (0)