google-developer-training / basic-android-kotlin-compose-training-cupcake

Apache License 2.0
73 stars 94 forks source link

Summary screen is passing the wrong value as the order total value #75

Open gdmalet opened 11 months ago

gdmalet commented 11 months ago

Existing code in SummaryScreen.kt uses both numberOfCupcakes and orderUiState.quantity, which are the same thing, and no dollar total. The following patch would correct that:

val orderSummary = stringResource(
        R.string.order_details,
         numberOfCupcakes,
         orderUiState.flavor,
         orderUiState.date,
-        orderUiState.quantity
+        orderUiState.price

Thus, instead of this as the output:

Quantity: 12 cupcakes
Flavor: Red Velvet
Pickup date: Wed Nov 29
Total: 12 

that Total line would show $24, which I'm sure was the original intention.