Skip to content

Commit

Permalink
Bump up to 4.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
qifeng-bai committed Jan 19, 2025
2 parents 992919e + a6252f0 commit 7eaf464
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* rights and limitations under the License.
*/
buildscript {
version "4.4.0"
version "4.4.1"
group "au.org.ala"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ class AdminController {
qr.previousCheck = qr.lastChecked
qr.lastChecked = since
query.lastChecked = since


def records = notificationService.retrieveRecordForQuery(qr.query, qr)

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

def alaUser = authService.userDetails()
def user = userService.getUserByEmail(alaUser?.email)
def user = User.findByEmail(alaUser?.email)
def unsubscribeToken = notificationService.getUnsubscribeToken(user, query)
if (user && unsubscribeToken) {
unsubscribeOneUrl = urlPrefix + "/unsubscribe?token=${unsubscribeToken}"
Expand Down
5 changes: 4 additions & 1 deletion grails-app/domain/au/org/ala/alerts/Query.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class Query {
String recordJsonPath

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class NotificationService {
def grailsApplication
def dateFormatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")

@Transactional
QueryResult getQueryResult(Query query, Frequency frequency) {
QueryResult qr = QueryResult.findByQueryAndFrequency(query, frequency)
if (qr == null) {
Expand Down
45 changes: 23 additions & 22 deletions release/4.4.0-release.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,15 @@ update alerts.query set email_template='/email/annotations' where name='Annotati

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


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

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

-- 4. Species List Annotations now share the same template with datasets. To update the template, run the following query:
-- 4.1 Update fire_when_change to false for species list queries

UPDATE alerts.property_path
SET fire_when_change = false
WHERE query_id IN (
SELECT query_id
FROM query
WHERE email_template = '/email/specieslists'
);

-- -- 4.2
-- update alerts.query set email_template="/email/datasets" where email_template='/email/specieslists';

--- disable fire_when_change for spatial layer
UPDATE alerts.property_path
Expand Down Expand Up @@ -62,11 +51,11 @@ WHERE

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

UPDATE alerts.query
SET
base_url = 'https://biocache-ws-test.ala.org.au/ws'
WHERE
base_url LIKE 'https://api.test.ala.org.au/occurrences%';
-- UPDATE alerts.query
-- SET
-- base_url = 'https://biocache-ws-test.ala.org.au/ws'
-- WHERE
-- base_url LIKE 'https://api.test.ala.org.au/occurrences%';


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

-- 4. Species List Annotations now share the same template with datasets. To update the template, run the following query:
-- 4.1 Update fire_when_change to false for species list queries

--- NOT WORKING
--- ************************
UPDATE alerts.property_path
SET fire_when_change = false,
json_path = '$.lists'
WHERE query_id = [species list query id: 556];


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

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

Expand All @@ -115,6 +114,8 @@ SET `base_url` = 'https://biocache-ws.ala.org.au/ws',
`id_json_path` = 'i18nCode',
`query_path` = '/occurrences/search?q=*:*&facet=true&flimit=-1&facets=dataResourceUid&pageSize=0',
`record_json_path` = '$.facetResults[0].fieldResult[*]',
`email_template` = '/email/specieslist',
`base_url_forui` = 'https://collections-test.ala.org.au'
WHERE (`id` = 'Replace it');
`email_template` = '/email/dataresource',
`base_url_forui` = 'https://collections.ala.org.au'
WHERE (`id` = 'Replace it:7');

update property_path set json_path='$.facetResults[0].fieldResult', fire_when_change=false where id=[property_path id:12];

0 comments on commit 7eaf464

Please sign in to comment.