fix the sorting of organization contacts
This commit is contained in:
parent
73ff7f440e
commit
23d6e54718
|
@ -16,8 +16,8 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||
}
|
||||
|
||||
override fun compareTo(other: Contact): Int {
|
||||
val firstString: String
|
||||
val secondString: String
|
||||
var firstString: String
|
||||
var secondString: String
|
||||
|
||||
when {
|
||||
sorting and SORT_BY_FIRST_NAME != 0 -> {
|
||||
|
@ -34,6 +34,14 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
|
|||
}
|
||||
}
|
||||
|
||||
if (firstString.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty() && organization.company.isNotEmpty()) {
|
||||
firstString = organization.company
|
||||
}
|
||||
|
||||
if (secondString.isEmpty() && other.firstName.isEmpty() && other.middleName.isEmpty() && other.surname.isEmpty() && other.organization.company.isNotEmpty()) {
|
||||
secondString = other.organization.company
|
||||
}
|
||||
|
||||
var result = if (firstString.firstOrNull()?.isLetter() == true && secondString.firstOrNull()?.isLetter() == false) {
|
||||
-1
|
||||
} else if (firstString.firstOrNull()?.isLetter() == false && secondString.firstOrNull()?.isLetter() == true) {
|
||||
|
|
Loading…
Reference in New Issue