Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect code and directions in Read and update data using Room #128

Open
mschultz-1 opened this issue Jul 8, 2024 · 0 comments
Open

Comments

@mschultz-1
Copy link

URL of codelab:
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`

Specify the language of the codelab if it is not English:

In which task and step of the codelab can this issue be found?

(8) Implement and Sell Item

Add a function in the ViewModel

  1. Inside the launch block, create a val called currentItem and set it to uiState.value.toItem().

val currentItem = uiState.value.toItem()

The uiState.value is of the type ItemUiState. You convert it to the Item entity type with the extension function toItem().


Describe the problem

The instructions say that the uiState.value is of the type ItemUiState. It is not. It is of the type ItemDetailsUiState. Therefore, the correct code is uiState.value.itemDetails.toItem(), which you correctly have a subsequent code snippet after number list item 5.

I believe that, in order to fix this issue, you must change 3 places:

  • change the instructions in numbered item 3 to end with uiState.value.itemDetails.toItem()
  • change the code snippet following numbered item 3 to end with uiState.value.itemDetails.toItem()
  • change the text after the code snippet to say that uiState.value is of type ItemDetailsUiState, and also that in order to convert it to the Item entity type you need to access the property/member itemDetails and then use the extension function toItem().


Steps to reproduce?
n/a

Versions
n/a

Additional information
codelab_2024_07_08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant