Skip to content

Commit

Permalink
fix: Save attribute option combo (#3634)
Browse files Browse the repository at this point in the history
* fix: [ANDROAPP-6160] update selected options before getting catcombo uid

Signed-off-by: andresmr <[email protected]>

* fix: [ANDROAPP-6160] update version name 2.9.1.1 and version code 131

Signed-off-by: andresmr <[email protected]>

---------

Signed-off-by: andresmr <[email protected]>
  • Loading branch information
andresmr authored May 16, 2024
1 parent 8405abb commit d3cf8d4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class ConfigureEventCatCombo(
repository.catCombo().apply {
val categories = getCategories(this?.categories())
val categoryOptions = getCategoryOptions()
updateSelectedOptions(categoryOption, categories, categoryOptions)
val catComboUid = getCatComboUid(this?.uid() ?: "", this?.isDefault ?: false)
val catComboDisplayName = getCatComboDisplayName(this?.uid() ?: "")
updateSelectedOptions(categoryOption, categories, categoryOptions)

return flowOf(
EventCatCombo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fun ProvideCategorySelector(
modifier: Modifier = Modifier,
eventCatComboUiModel: EventCatComboUiModel,
) {
var selectedItem by remember {
var selectedItem by remember(eventCatComboUiModel.eventCatCombo.selectedCategoryOptions) {
mutableStateOf(
eventCatComboUiModel.eventCatCombo.selectedCategoryOptions[eventCatComboUiModel.category.uid]?.displayName()
?: eventCatComboUiModel.eventCatCombo.categoryOptions?.get(eventCatComboUiModel.category.uid)?.displayName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.hisp.dhis.android.core.category.CategoryCombo
import org.hisp.dhis.android.core.category.CategoryOption
import org.hisp.dhis.android.core.category.CategoryOptionCombo
import org.hisp.dhis.android.core.event.Event
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
Expand Down Expand Up @@ -70,12 +71,17 @@ class ConfigureEventCatComboTest {
whenever(
repository.getCatOption(CATEGORY_OPTION_UID),
) doReturn categoryOption
whenever(
repository.getCategoryOptionCombo(CATEGORY_COMBO_UID, listOf(CATEGORY_OPTION_UID)),
) doReturn CATEGORY_OPTION_COMBO_UID

// When catCombo is invoked
val eventCatCombo = configureEventCatCombo.invoke(selectedCategoryOption).first()

// Then should be completed
assertTrue(eventCatCombo.isCompleted)
// And the EventCatCombo uid should be set
assertEquals(eventCatCombo.uid, CATEGORY_OPTION_COMBO_UID)
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
ndk = "21.4.7075529"
sdk = "34"
minSdk = "21"
vCode = "130"
vName = "2.9.1"
vCode = "131"
vName = "2.9.1.1"
kotlinCompilerExtensionVersion = "1.5.6"
gradle = "8.2.0"
kotlin = '1.9.21'
Expand Down

0 comments on commit d3cf8d4

Please sign in to comment.