-
Notifications
You must be signed in to change notification settings - Fork 0
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
Correcciones #2
base: main
Are you sure you want to change the base?
Correcciones #2
Conversation
…pantalla principal y luego volver a apretar otro boton que dice 'escanear'.
…e chequea el campo)
…a api request que actualiza el token)
…la mesa para anunciarse"
…o sin asociarse a una mesa antes"
…y otros que estan en ingles"
…mpre devuelven 200...)"
…."+"socket-io no se usa"+"metodos en viewmodels podrian ser privados"
…r pedidos pendientes, etc"
@@ -92,7 +93,7 @@ fun InviteTicket(navCont: NavController, userViewModel: UserViewModel, tableView | |||
val indice:Int =tableViewModel.estadoMesa.invitados.indexOfFirst{ e -> e.idCliente == userViewModel.estadoUser.idCliente} | |||
val yo = if(indice !=-1) tableViewModel.estadoMesa.invitados[indice] else null | |||
if (yo != null) { | |||
Text(text ="Consumido: $"+"%,.1f".format(Locale.GERMAN,yo.total), | |||
Text(text = stringResource(id = R.string.inviteticket_consumido)+"%,.1f".format(Locale.GERMAN,yo.total), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
el formato tiene que ser parte de la string, y stringResource
interpola los valores adicionales que se pasen:
stringResource(id = R.string.inviteticket_consumido, yo.total)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En general está bien. Marqué unas cositas nomás pero está aprobado.
if (idCli.isSuccessful) { | ||
dataStore.edit { preferences -> | ||
preferences[intPreferencesKey("idCliente")] = idCli.body()!!.idCliente |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Siempre traten de evitar usar !!
a menos que estén completamente seguros de que lo que tienen no es opcional.
Siendo una respuesta del servidor, que es algo externo a la app, no se puede tener esa seguridad así que lo mejor es chequear que no sea null:
val body = idCli.body()
if (idCli.isSuccessful && body != null) {
dataStore.edit { preferences ->
preferences[intPreferencesKey("idCliente")] = body.idCliente
de esa manera el compilador ya se asegura que body
no es null y no requiere ?
ni !!
.
ExtendedFloatingActionButton( | ||
modifier = Modifier.align(Alignment.TopEnd).padding(0.dp) | ||
.wrapContentSize(), | ||
onClick = { viewmodelo.getPedidosState(userViewModel.estadoUser.idMesa) }, | ||
shape = CircleShape, | ||
containerColor = MaterialTheme.colorScheme.secondaryContainer, | ||
contentColor = MaterialTheme.colorScheme.secondary | ||
) { | ||
Icon(imageVector = Icons.Rounded.Refresh, contentDescription = "") | ||
Text(text = "Actualizar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
También podrían haber usado un Pull To Refresh:
https://developer.android.com/reference/kotlin/androidx/compose/material/pullrefresh/package-summary
) | ||
}else { | ||
Text( | ||
text = "$" + "%,.1f".format(Locale.GERMAN, ped.cantidad * ped.plato.precio), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me intriga por qué usaron Locale.GERMAN
en vez de Locale.current
.
Corregimos los puntos señalados:
Nota: se trató de que cada commit se corresponda con una corrección (igualmente hay algunos pequeños cambios que están desfasados)