Skip to content

Commit acf7b82

Browse files
committed
Merge branch 'develop' of https://github.com/AtlasOfLivingAustralia/alerts into develop
2 parents 8d0c632 + 697a295 commit acf7b82

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

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) {

0 commit comments

Comments
 (0)