Skip to content

Commit 67d6665

Browse files
committed
#381 annotation/myAnnotation do not included those deleted
and few style changes
1 parent 249bc57 commit 67d6665

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ class AnnotationService {
105105
}
106106
}.values()
107107

108-
108+
//Decision: #381 Do not included those records
109109
//if an occurrence record exists in previous result but not in current, it means the annotation is deleted.
110110
//We need to add these records as a 'modified' record
111-
records.addAll(oldRecordsMap.findAll { !curRecordsMap.containsKey(it.value.uuid) }.values())
111+
//records.addAll(oldRecordsMap.findAll { !curRecordsMap.containsKey(it.value.uuid) }.values())
112112

113113
return records
114114
}

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

+15-13
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,23 @@ class MyAnnotationService{
6969

7070
}.values()
7171

72-
// make a copy of the records list to make it mutable
7372
def mutableRecords = new ArrayList(records)
74-
//if an occurrence record exists in previous result but not in current, it means the annotation is deleted.
75-
//We need to add these records as a 'modified' record
76-
//mutableRecords.addAll(oldRecordsMap.findAll { !curRecordsMap.containsKey(it.value.uuid) }.values())
7773

78-
def missingEntries = oldRecordsMap.findAll { entry ->
79-
def record = entry.value // Get the value from the map entry
80-
!curRecordsMap.containsKey(record.uuid) // Check if the uuid is missing in curRecordsMap
81-
}
82-
Collection missingRecords = missingEntries.values()
83-
if (missingRecords.size() > 0) {
84-
log.info("Found ${missingRecords.size()} missing records: ${missingRecords.collect { it.uuid }}")
85-
mutableRecords.addAll(missingRecords)
86-
}
74+
// // Decision: #381 Do not included those records which their annotation was deleted
75+
// // make a copy of the records list to make it mutable
76+
// //if an occurrence record exists in previous result but not in current, it means the annotation is deleted.
77+
// //We need to add these records as a 'modified' record
78+
// //mutableRecords.addAll(oldRecordsMap.findAll { !curRecordsMap.containsKey(it.value.uuid) }.values())
79+
//
80+
// def missingEntries = oldRecordsMap.findAll { entry ->
81+
// def record = entry.value // Get the value from the map entry
82+
// !curRecordsMap.containsKey(record.uuid) // Check if the uuid is missing in curRecordsMap
83+
// }
84+
// Collection missingRecords = missingEntries.values()
85+
// if (missingRecords.size() > 0) {
86+
// log.info("Found ${missingRecords.size()} missing records: ${missingRecords.collect { it.uuid }}")
87+
// mutableRecords.addAll(missingRecords)
88+
// }
8789

8890
return mutableRecords
8991
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class QueryService {
332332
}
333333

334334
String constructMyAnnotationQueryPath(String userId) {
335-
'/occurrences/search?fq=assertion_user_id:' + userId + '&dir=desc&pageSize=300'
335+
'/occurrences/search?fq=assertion_user_id:' + userId + '&dir=desc&pageSize=500'
336336
}
337337

338338
/**

grails-app/views/admin/query.gsp

+14-7
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,16 @@
102102
</g:else>
103103
</div>
104104
<div>
105-
<b>${queryResult.frequency?.name?.toUpperCase()}</b>
106-
query result ID: <g:link controller="queryResult" action="getDetails" params="[id: queryResult.id]" target="_blank"> <span class="badge badge-primary">${queryResult.id}</span></g:link>
105+
<%
106+
def maxEmails = 15
107+
def emailList = query.notifications?.collect { it.user?.email }?.findAll { it } ?: []
108+
def subscribers = emailList.take(maxEmails).join('; ') // Take first 10
109+
if (emailList.size() > maxEmails) {
110+
subscribers += ' ......'
111+
}
112+
%>
113+
<g:link controller="queryResult" action="getDetails" params="[id: queryResult.id]" target="_blank"> <span class="badge badge-primary"><i class="fa fa-info-circle" aria-hidden="true"></i> ${queryResult.id}</span></g:link> &nbsp;<b><i class="fa fa-calendar-check-o" aria-hidden="true"></i> ${queryResult.frequency?.name?.toUpperCase()}</b>
114+
&nbsp; <label title="${subscribers}"><span class="badge badge-info"> <i class="fa fa-user"></i> ${query.countSubscribers(queryResult.frequency?.name)}</span></label>
107115

108116
<g:if test="${queryResult?.lastChecked}">
109117
Last checked: ${queryResult?.lastChecked}&nbsp;&nbsp;
@@ -119,13 +127,12 @@
119127
<br/>
120128
<b><i class="fa fa-warning" style="color:#c44d34"></i> Resetting the previous and current results of this record to help testers identify new records.</b><button class="btn btn-primary" onclick="resetResultsInDB(${queryResult.id})">Reset</button>
121129
</g:if>
122-
<br/>
123-
Subscribers:${query.countSubscribers(queryResult.frequency?.name)}
130+
124131
</div>
125132
<div>
126133
<g:each var="pv" in="${queryResult.propertyValues}">
127134
<span class="badge badge-light">${pv.propertyPath.id}</span> ${pv.propertyPath}<br>
128-
<span class="badge badge-light">${pv.id}</span> Current Value: ${pv.currentValue}; Previous Value: ${pv.previousValue} <br>
135+
%{-- <span class="badge badge-light">${pv.id}</span> Current Value: ${pv.currentValue}; Previous Value: ${pv.previousValue} <br>--}%
129136
</g:each>
130137
</div>
131138
<div style="text-align: right;">
@@ -140,7 +147,7 @@
140147
<g:if test="${queryType != 'biosecurity'}">
141148
<div style="padding: 5px;">
142149
<label>Query the latest records from the data services
143-
<i class="fa fa-info-circle" aria-hidden="true" style="color: #c44d34;"
150+
<i class="fa fa-question-circle-o" aria-hidden="true" style="color: #c44d34;"
144151
title="The query may use the last checked date. The query may end on that date, span a period around that date, or not used at all. e.g, if the last checked date of a Monthly Image alerts is 1 Jan 2025, this function will query the images which were uploaded from 1 Dec 2024 to current time"></i>
145152
, compare them with the current records in Alerts, and email me the findings.</label>
146153
<g:link class="btn btn-info" controller="admin" action="emailMeLastCheck" params="[queryId: query.id, frequency: queryResult.frequency?.name]" target="_blank">
@@ -167,7 +174,7 @@
167174
<g:else>
168175
query
169176
</g:else>
170-
against the given date <i class="fa fa-info-circle" aria-hidden="true" style="color: #c44d34;"
177+
against the given date <i class="fa fa-question-circle-o" aria-hidden="true" style="color: #c44d34;"
171178
title="It may be set as starting from that date, ending on that date, spanning a period around that date, or not used at all."></i>
172179
, and email new records. The date range associated with the given date is determined by the query.
173180

0 commit comments

Comments
 (0)