google-developer-training / basic-android-kotlin-compose-training-inventory-app

Apache License 2.0
77 stars 84 forks source link

Read and update data using Room - sell button always enabled #47

Open fe60 opened 1 year ago

fe60 commented 1 year ago

[Android Basics with Compose Unit 6: Data persistence Use Room for data persistence Read and update data with Room

  1. Implement sell item](https://developer.android.com/codelabs/basic-android-kotlin-compose-update-data-room?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-6-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-update-data-room#7)

In which task and step of the codelab can this issue be found? section Add a function in the ViewModel, step 13

Describe the problem

  1. Run your app. Notice that the app disables the Sell button when the quantity in stock is zero.

Button is not disabled. The related argument is always true in branch room. https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/blob/d118e8d77b7318deda5ddbfa8539f7578e2ade8c/app/src/main/java/com/example/inventory/ui/item/ItemDetailsScreen.kt#L118-L123

It should be enabled = !itemDetailsUiState.outOfStock as in branch main