Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Felix Foertsch
Luca Android
Commits
440d006c
Commit
440d006c
authored
Aug 26, 2021
by
Ulrich Scheller
Browse files
Release 1.13.1
parent
819dd93b
Changes
7
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
440d006c
# Release 1.13.1
This update fixes an issue with imported documents not being visible.
# Release 1.13.0
-
Document import for children
...
...
Luca/app/build.gradle
View file @
440d006c
...
...
@@ -11,8 +11,8 @@ android {
applicationId
"de.culture4life.luca"
minSdkVersion
21
targetSdkVersion
30
versionCode
8
1
versionName
"1.13.
0
"
versionCode
8
2
versionName
"1.13.
1
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs
{
...
...
Luca/app/src/main/java/de/culture4life/luca/document/provider/DocumentProvider.java
View file @
440d006c
...
...
@@ -12,8 +12,6 @@ import org.joda.time.DateTime;
import
java.util.List
;
import
java.util.NoSuchElementException
;
import
javax.annotation.Nonnull
;
import
de.culture4life.luca.children.Child
;
import
de.culture4life.luca.document.DocumentVerificationException
;
import
de.culture4life.luca.registration.Person
;
...
...
@@ -49,8 +47,8 @@ public abstract class DocumentProvider<DocumentType extends ProvidedDocument> {
return
Observable
.
mergeDelayError
(
personsToValidate
.
map
(
personToValidate
->
validateName
(
document
,
personToValidate
)
.
andThen
(
setName
(
document
,
personToValidate
))
.
andThen
(
Observable
.
just
(
personToValidate
))
.
andThen
(
setName
(
document
,
personToValidate
))
.
andThen
(
Observable
.
just
(
personToValidate
))
.
onErrorResumeWith
(
Observable
.
empty
())
)
)
...
...
@@ -88,8 +86,11 @@ public abstract class DocumentProvider<DocumentType extends ProvidedDocument> {
protected
Completable
validateName
(
@NonNull
DocumentType
document
,
@NonNull
Person
person
)
{
return
Completable
.
fromAction
(()
->
{
compare
(
person
.
getFirstName
(),
document
.
getDocument
().
getFirstName
());
compare
(
person
.
getLastName
(),
document
.
getDocument
().
getLastName
());
if
(!
Person
.
Companion
.
compare
(
person
.
getFirstName
(),
document
.
getDocument
().
getFirstName
())
||
!
Person
.
Companion
.
compare
(
person
.
getLastName
(),
document
.
getDocument
().
getLastName
()))
{
throw
new
DocumentVerificationException
(
NAME_MISMATCH
);
}
}).
andThen
(
validateTime
(
document
.
document
.
getTestingTimestamp
()));
}
...
...
@@ -112,25 +113,4 @@ public abstract class DocumentProvider<DocumentType extends ProvidedDocument> {
}
});
}
private
static
void
compare
(
@NonNull
String
s1
,
@Nonnull
String
s2
)
throws
DocumentVerificationException
{
s1
=
removeAcademicTitles
(
s1
);
s2
=
removeAcademicTitles
(
s2
);
if
(!
simplify
(
s1
).
equalsIgnoreCase
(
simplify
(
s2
)))
{
throw
new
DocumentVerificationException
(
NAME_MISMATCH
);
}
}
protected
static
String
removeAcademicTitles
(
String
name
)
{
name
=
name
.
replaceAll
(
"(?i)Prof\\. "
,
""
);
name
=
name
.
replaceAll
(
"(?i)Dr\\. "
,
""
);
return
name
;
}
protected
static
String
simplify
(
String
name
)
{
name
=
name
.
toUpperCase
();
name
=
name
.
replaceAll
(
"[^\\x41-\\x5A]"
,
""
);
return
name
;
}
}
Luca/app/src/main/java/de/culture4life/luca/document/provider/opentestcheck/OpenTestCheckDocumentProvider.java
View file @
440d006c
...
...
@@ -110,7 +110,7 @@ public class OpenTestCheckDocumentProvider extends DocumentProvider<OpenTestChec
}
protected
Single
<
String
>
generateNameHash
(
@NonNull
Person
person
)
{
return
Single
.
fromCallable
(()
->
simplify
(
person
.
getFullName
()).
getBytes
(
StandardCharsets
.
US_ASCII
))
return
Single
.
fromCallable
(()
->
Person
.
Companion
.
simplify
(
person
.
getFullName
()).
getBytes
(
StandardCharsets
.
US_ASCII
))
.
flatMap
(
HASH_PROVIDER:
:
hash
).
map
(
Hex:
:
bytesToStringLowercase
);
}
...
...
Luca/app/src/main/java/de/culture4life/luca/registration/Person.kt
View file @
440d006c
...
...
@@ -18,5 +18,26 @@ open class Person(
override
fun
toString
()
=
getFullName
()
companion
object
{
fun
compare
(
s1
:
String
,
s2
:
String
):
Boolean
{
var
s1
=
removeAcademicTitles
(
s1
)
var
s2
=
removeAcademicTitles
(
s2
)
return
simplify
(
s1
).
equals
(
simplify
(
s2
),
ignoreCase
=
true
)
}
fun
removeAcademicTitles
(
name
:
String
):
String
{
var
name
=
name
name
=
name
.
replace
(
"(?i)Prof\\. "
.
toRegex
(),
""
)
name
=
name
.
replace
(
"(?i)Dr\\. "
.
toRegex
(),
""
)
return
name
}
fun
simplify
(
name
:
String
):
String
{
var
name
=
name
name
=
name
.
toUpperCase
()
name
=
name
.
replace
(
"[^\\x41-\\x5A]"
.
toRegex
(),
""
)
return
name
}
}
}
Luca/app/src/main/java/de/culture4life/luca/ui/myluca/MyLucaListAdapter.java
View file @
440d006c
...
...
@@ -191,11 +191,18 @@ public class MyLucaListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
protected
static
boolean
isFrom
(
@NonNull
MyLucaListItem
item
,
@NonNull
Person
person
)
{
String
firstName
=
item
.
document
.
getFirstName
();
String
lastName
=
item
.
document
.
getLastName
();
boolean
isSameName
=
person
.
getFirstName
().
equals
(
firstName
)
&&
person
.
getLastName
().
equals
(
lastName
);
boolean
isSameName
=
true
;
if
(
firstName
!=
null
)
{
isSameName
=
Person
.
Companion
.
compare
(
person
.
getFirstName
(),
firstName
)
&&
Person
.
Companion
.
compare
(
person
.
getLastName
(),
lastName
);
}
if
(
person
instanceof
Child
)
{
return
isSameName
;
return
isSameName
&&
firstName
!=
null
;
}
else
{
return
isSameName
||
firstName
==
null
;
return
isSameName
;
}
}
}
\ No newline at end of file
Luca/app/src/test/java/de/culture4life/luca/ui/myluca/MyLucaListAdapterTest.kt
View file @
440d006c
...
...
@@ -48,9 +48,25 @@ class MyLucaListAdapterTest : LucaUnitTest() {
assertFalse
(
MyLucaListAdapter
.
isFrom
(
item
,
Person
(
"Janine"
,
"Mustermann"
)))
}
@Test
fun
isFrom_personNameDifferentCase_returnsTrue
()
{
assertTrue
(
MyLucaListAdapter
.
isFrom
(
item
,
Person
(
"eRiKa"
,
"mUsTeRmAnN"
)))
}
@Test
fun
isFrom_titlesAreFiltered_returnTrue
()
{
assertTrue
(
MyLucaListAdapter
.
isFrom
(
item
,
Person
(
"Prof. Dr. Erika"
,
"Mustermann"
)))
}
@Test
fun
isFrom_specialCharsRemoved_returnTrue
()
{
assertTrue
(
MyLucaListAdapter
.
isFrom
(
item
,
Person
(
"Erikâa"
,
"Mustêermann"
)))
}
@Test
fun
sortAndPairItems_correctPerson_returnsHeaderAndItem
()
{
val
items
=
MyLucaListAdapter
.
sortAndPairItems
(
listOf
(
item
),
listOf
(
Person
(
"Erika"
,
"Mustermann"
)))
val
items
=
MyLucaListAdapter
.
sortAndPairItems
(
listOf
(
item
),
listOf
(
Person
(
"Erika"
,
"Mustermann"
)))
assertEquals
(
items
[
0
].
sectionHeader
,
"Erika Mustermann"
)
assertEquals
(
items
[
1
].
items
[
0
],
item
)
}
...
...
@@ -66,7 +82,8 @@ class MyLucaListAdapterTest : LucaUnitTest() {
@Test
fun
sortAndPairItems_wrongPerson_returnsEmptyList
()
{
val
items
=
MyLucaListAdapter
.
sortAndPairItems
(
listOf
(
item
),
listOf
(
Person
(
"Anyone"
,
"Else"
)))
val
items
=
MyLucaListAdapter
.
sortAndPairItems
(
listOf
(
item
),
listOf
(
Person
(
"Anyone"
,
"Else"
)))
assertEquals
(
0
,
items
.
size
)
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment