Skip to content

Commit 7eaf464

Browse files
committed
Bump up to 4.4.1
2 parents 992919e + a6252f0 commit 7eaf464

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* rights and limitations under the License.
1212
*/
1313
buildscript {
14-
version "4.4.0"
14+
version "4.4.1"
1515
group "au.org.ala"
1616
}
1717

grails-app/controllers/au/org/ala/alerts/AdminController.groovy

+1-3
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ class AdminController {
372372
qr.previousCheck = qr.lastChecked
373373
qr.lastChecked = since
374374
query.lastChecked = since
375-
376-
377375
def records = notificationService.retrieveRecordForQuery(qr.query, qr)
378376

379377
String urlPrefix = "${grailsApplication.config.getProperty("grails.serverURL")}${grailsApplication.config.getProperty('security.cas.contextPath', '')}"
@@ -383,7 +381,7 @@ class AdminController {
383381
def unsubscribeOneUrl
384382

385383
def alaUser = authService.userDetails()
386-
def user = userService.getUserByEmail(alaUser?.email)
384+
def user = User.findByEmail(alaUser?.email)
387385
def unsubscribeToken = notificationService.getUnsubscribeToken(user, query)
388386
if (user && unsubscribeToken) {
389387
unsubscribeOneUrl = urlPrefix + "/unsubscribe?token=${unsubscribeToken}"

grails-app/domain/au/org/ala/alerts/Query.groovy

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class Query {
2323
String recordJsonPath
2424

2525
transient String listId //species list id
26-
transient Date lastChecked // Date when the last execution performed
26+
// Date when the last execution performed.
27+
// NOTE: Except Biosecurity, other queries may have 4 lastChecked dates, matching the 4 frequencies
28+
// Only used for passing the checked date to the Email template
29+
transient Date lastChecked
2730

2831
static hasMany = [notifications: Notification, queryResults: QueryResult, propertyPaths: PropertyPath]
2932

grails-app/services/au/org/ala/alerts/BiosecurityService.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class BiosecurityService {
5454
*/
5555
def triggerBiosecuritySubscription(Query query) {
5656
//If has not been checked before, then set the lastChecked to 7 days before
57-
Date lastChecked = query.lastChecked ?: DateUtils.addDays(new Date(), -1 * grailsApplication.config.getProperty("biosecurity.legacy.firstLoadedDateAge", Integer, 7))
57+
Date lastChecked = queryService.getLastCheckedDate(query) ?: DateUtils.addDays(new Date(), -1 * grailsApplication.config.getProperty("biosecurity.legacy.firstLoadedDateAge", Integer, 7))
5858
triggerBiosecuritySubscription(query, lastChecked)
5959
}
6060

grails-app/services/au/org/ala/alerts/NotificationService.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class NotificationService {
2525
def grailsApplication
2626
def dateFormatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
2727

28-
@Transactional
2928
QueryResult getQueryResult(Query query, Frequency frequency) {
3029
QueryResult qr = QueryResult.findByQueryAndFrequency(query, frequency)
3130
if (qr == null) {

release/4.4.0-release.sql

+23-22
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,15 @@ update alerts.query set email_template='/email/annotations' where name='Annotati
55

66
-- 2. My Annotations now uses its own template. To update the template, run the following query:
77
update alerts.query set email_template='/email/myAnnotations' where name='My Annotations';
8+
--- check
9+
810

911
-- 3. Annotation on records for Dataset / collections / species now uses its "Annotation" template. To update the template, run the following query:
1012

1113
UPDATE alerts.query
1214
SET email_template = '/email/annotations'
1315
WHERE name LIKE 'New annotations on%';
1416

15-
-- 4. Species List Annotations now share the same template with datasets. To update the template, run the following query:
16-
-- 4.1 Update fire_when_change to false for species list queries
17-
18-
UPDATE alerts.property_path
19-
SET fire_when_change = false
20-
WHERE query_id IN (
21-
SELECT query_id
22-
FROM query
23-
WHERE email_template = '/email/specieslists'
24-
);
25-
26-
-- -- 4.2
27-
-- update alerts.query set email_template="/email/datasets" where email_template='/email/specieslists';
2817

2918
--- disable fire_when_change for spatial layer
3019
UPDATE alerts.property_path
@@ -62,11 +51,11 @@ WHERE
6251

6352
-- Update some queries using api.test.ala.org.au and api.ala.org.au
6453

65-
UPDATE alerts.query
66-
SET
67-
base_url = 'https://biocache-ws-test.ala.org.au/ws'
68-
WHERE
69-
base_url LIKE 'https://api.test.ala.org.au/occurrences%';
54+
-- UPDATE alerts.query
55+
-- SET
56+
-- base_url = 'https://biocache-ws-test.ala.org.au/ws'
57+
-- WHERE
58+
-- base_url LIKE 'https://api.test.ala.org.au/occurrences%';
7059

7160

7261
UPDATE alerts.query
@@ -96,12 +85,22 @@ UPDATE `alerts`.`query`
9685
`base_url_forui` = 'https://lists.ala.org.au'
9786
WHERE (`id` = 'Replace it');
9887

88+
-- 4. Species List Annotations now share the same template with datasets. To update the template, run the following query:
89+
-- 4.1 Update fire_when_change to false for species list queries
90+
91+
--- NOT WORKING
92+
--- ************************
93+
UPDATE alerts.property_path
94+
SET fire_when_change = false,
95+
json_path = '$.lists'
96+
WHERE query_id = [species list query id: 556];
97+
9998

10099
--- Update query of datasets to match query of datasetResource
101100

102101
--- If datasetResource query already exists, then update the query id of the subscribers to datasetResource query id
103102
--- Find the query id which needs to migrate subscribers to datasetResource. e.g. query id: 7
104-
select * from notification where query_id = [id];
103+
select * from notification where query_id = [id:7];
105104
--- find subscribers details
106105
select * from user where id in (SELECT user_id FROM alerts.notification where query_id=[id]);
107106

@@ -115,6 +114,8 @@ SET `base_url` = 'https://biocache-ws.ala.org.au/ws',
115114
`id_json_path` = 'i18nCode',
116115
`query_path` = '/occurrences/search?q=*:*&facet=true&flimit=-1&facets=dataResourceUid&pageSize=0',
117116
`record_json_path` = '$.facetResults[0].fieldResult[*]',
118-
`email_template` = '/email/specieslist',
119-
`base_url_forui` = 'https://collections-test.ala.org.au'
120-
WHERE (`id` = 'Replace it');
117+
`email_template` = '/email/dataresource',
118+
`base_url_forui` = 'https://collections.ala.org.au'
119+
WHERE (`id` = 'Replace it:7');
120+
121+
update property_path set json_path='$.facetResults[0].fieldResult', fire_when_change=false where id=[property_path id:12];

0 commit comments

Comments
 (0)