Skip to content

Commit 9fbf487

Browse files
authored
Merge pull request #413 from alexhuang091/release/2.6.1
Release/2.6.1
2 parents daa70fd + 85fdc4b commit 9fbf487

10 files changed

+160
-110
lines changed

conf/cassandra3_case_sensitive_schema.txt

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ CREATE TABLE occ.qa (
114114
"userDisplayName" text,
115115
"userEmail" text,
116116
uuid text,
117+
relatedrecordid text,
118+
relatedrecordreason text,
117119
PRIMARY KEY (rowkey, "userId", code)
118120
) WITH CLUSTERING ORDER BY ("userId" ASC, code ASC)
119121
AND bloom_filter_fp_chance = 0.01

conf/cassandra3_schema.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ CREATE TABLE qa (
105105
userentityuid text,
106106
userid text,
107107
userrole text,
108-
value text
108+
value text,
109+
relatedrecordid text,
110+
relatedrecordreason text,
109111
) WITH bloom_filter_fp_chance = 0.01
110112
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
111113
AND comment = ''

pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<parent>
55
<groupId>au.org.ala</groupId>
66
<artifactId>ala-parent-pom</artifactId>
7-
<version>11</version>
7+
<version>14</version>
88
</parent>
99

1010
<groupId>au.org.ala</groupId>
1111
<artifactId>biocache-store</artifactId>
12-
<version>2.6.0</version>
12+
<version>2.6.1</version>
1313
<url>https://biocache.ala.org.au</url>
1414
<issueManagement>
1515
<system>GitHub</system>
@@ -348,7 +348,7 @@
348348
<dependency>
349349
<groupId>junit</groupId>
350350
<artifactId>junit</artifactId>
351-
<version>4.12</version>
351+
<version>4.13.1</version>
352352
<scope>test</scope>
353353
</dependency>
354354
<dependency>

src/main/scala/au/org/ala/biocache/dao/OccurrenceDAOImpl.scala

+17-6
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ class OccurrenceDAOImpl extends OccurrenceDAO {
745745
}
746746

747747
// Updating system assertion, pass in false
748-
val (userAssertionStatus, trueUserAssertions) = getCombinedUserStatus(false, userAssertions)
748+
val (userAssertionStatus, trueUserAssertions, originalAssertions) = getCombinedUserStatus(false, userAssertions)
749749

750750
val verified = if (userAssertionStatus == AssertionStatus.QA_VERIFIED || userAssertionStatus == AssertionStatus.QA_CORRECTED) true else false
751751

@@ -910,7 +910,7 @@ class OccurrenceDAOImpl extends OccurrenceDAO {
910910
persistenceManager.put(rowKey, qaEntityName, qaMap, true, false)
911911
val systemAssertions = getSystemAssertions(rowKey)
912912
val userAssertions = getUserAssertions(rowKey)
913-
updateAssertionStatus(rowKey, qualityAssertion, systemAssertions, userAssertions :+ qualityAssertion)
913+
updateAssertionStatus(rowKey, qualityAssertion, systemAssertions, userAssertions)
914914

915915
//set the last user assertion date
916916
persistenceManager.put(rowKey, entityName, FullRecordMapper.lastUserAssertionDateColumn, qualityAssertion.created, false, false)
@@ -1008,15 +1008,25 @@ class OccurrenceDAOImpl extends OccurrenceDAO {
10081008
* If Collection Admin verifies the record, currentAssertion will have
10091009
* code: 50000 (AssertionCodes.VERIFIED.code),
10101010
* qaStatus: AssertionStatus.QA_OPEN_ISSUE, AssertionStatus.QA_VERIFIED, AssertionStatus:QA_CORRECTED
1011+
*
1012+
* Alex updated on 07/12/2020, combinedUserAssertions contains all assertions in 50005 or 50001 state (outstanding assertions)
1013+
* originalAssertions contains all assertions users (not admin) made. Keep the original interface just to make sure new change
1014+
* doesn't break anything
10111015
*/
1012-
private def getCombinedUserStatus(bVerified: Boolean, userAssertions: List[QualityAssertion]): (Int, ArrayBuffer[QualityAssertion]) = {
1016+
private def getCombinedUserStatus(bVerified: Boolean, userAssertions: List[QualityAssertion]): (Int, ArrayBuffer[QualityAssertion], ArrayBuffer[QualityAssertion]) = {
10131017

10141018
// Filter off only verified records
10151019
val verifiedAssertions = userAssertions.filter(qa => qa.code == AssertionCodes.VERIFIED.code)
10161020

10171021
// Filter off only user assertions type
10181022
val assertions = userAssertions.filter(qa => qa.code != AssertionCodes.VERIFIED.code && AssertionStatus.isUserAssertionType(qa.qaStatus))
10191023

1024+
var originalAssertions = new ArrayBuffer[QualityAssertion]()
1025+
// qa.relatedUuid == null means it's not a verification because a verification must have an associated assertion thus relatedUuid not null
1026+
assertions.filter(qa => qa.relatedUuid == null).foreach {
1027+
originalAssertions.append(_)
1028+
}
1029+
10201030
// Sort the verified list according to relatedUuid and order of reference rowKey.
10211031
// RowKey for verified records consist of rowKey|userId|code|recNum where recNum increments everytime a verified record is added
10221032
val sortedList = verifiedAssertions.sortWith(QualityAssertion.compareByReferenceRowKeyDesc).sortBy(_.relatedUuid)
@@ -1072,7 +1082,7 @@ class OccurrenceDAOImpl extends OccurrenceDAO {
10721082

10731083
logger.debug("Overall assertion Status: " + userAssertionStatus)
10741084

1075-
(userAssertionStatus, combinedUserAssertions)
1085+
(userAssertionStatus, combinedUserAssertions, originalAssertions)
10761086
}
10771087

10781088
/**
@@ -1083,7 +1093,7 @@ class OccurrenceDAOImpl extends OccurrenceDAO {
10831093
logger.debug("Updating the assertion status for : " + rowKey)
10841094

10851095
val bVerified = AssertionCodes.isVerified(assertion)
1086-
val (userAssertionStatus, remainingAssertions) = getCombinedUserStatus(bVerified, userAssertions)
1096+
val (userAssertionStatus, remainingAssertions, originalAssertions) = getCombinedUserStatus(bVerified, userAssertions)
10871097

10881098
// default to the assertion which is to be evaluated
10891099
var actualAssertion = assertion
@@ -1152,7 +1162,8 @@ class OccurrenceDAOImpl extends OccurrenceDAO {
11521162
logger.debug("Final " + listErrorCodes)
11531163

11541164
//update the list
1155-
persistenceManager.put(rowKey, entityName, FullRecordMapper.userQualityAssertionColumn, Json.toJSON(remainingAssertions.toList), false, false)
1165+
// use all user assertions (no matter if it's already verified) to fill userQualityAssertionColumn so that assertion_user_id can be extracted correctly when reindexing
1166+
persistenceManager.put(rowKey, entityName, FullRecordMapper.userQualityAssertionColumn, Json.toJSON(originalAssertions.toList), false, false)
11561167
persistenceManager.putList(rowKey, entityName, FullRecordMapper.markAsQualityAssertion(phase), listErrorCodes.toList, classOf[Int], false, true, false)
11571168

11581169
//set the overall decision if necessary

0 commit comments

Comments
 (0)