Skip to content

Commit

Permalink
fix: [ANDROAPP-6197] Incorrect header in TEI Dashboard card (#3670)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan authored Jun 10, 2024
1 parent 36837c9 commit f7c75c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ class TEICardMapper(
}

private fun getTitle(item: SearchTeiModel): String {
return if (item.header != null) {
item.header!!
} else if (item.attributeValues.isEmpty()) {
"-"
} else {
val key = item.attributeValues.keys.firstOrNull()
val value = item.attributeValues.values.firstOrNull()?.value()
return item.header ?: run {
val key = item.attributeValues.keys.firstOrNull() ?: "-"
val value = item.attributeValues.values.firstOrNull()?.value() ?: "-"
"$key: $value"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class TeiDashboardCardMapper(
?.let {
val attribute = it.filterAttributes().firstOrNull()
val key = attribute?.first?.displayFormName()
val value = attribute?.second?.value()
val value = attribute?.second?.value()?.takeIf { attrValue ->
attrValue.isNotEmpty()
} ?: "-"
"$key: $value"
} ?: "-"

Expand All @@ -102,7 +104,7 @@ class TeiDashboardCardMapper(
if (it.first.valueType() == ValueType.PHONE_NUMBER) {
AdditionalInfoItem(
key = "${it.first.displayFormName()}:",
value = it.second.value() ?: "",
value = it.second.value()?.takeIf { attrValue -> attrValue.isNotEmpty() } ?: "-",
icon = {
Icon(
imageVector = Icons.Filled.PhoneEnabled,
Expand Down Expand Up @@ -246,5 +248,4 @@ class TeiDashboardCardMapper(
this.filter { it.first.valueType() != ValueType.IMAGE }
.filter { it.first.valueType() != ValueType.COORDINATE }
.filter { it.first.valueType() != ValueType.FILE_RESOURCE }
.filter { it.second.value()?.isNotEmpty() == true }
}

0 comments on commit f7c75c7

Please sign in to comment.