защита от приколистов
This commit is contained in:
parent
39f2cf609c
commit
4b84248c66
@ -193,7 +193,7 @@ private fun SessionListItem(
|
||||
Text(
|
||||
text = "${session.cinema.name}, ${session.cinema.year}\n" +
|
||||
"Цена: ${session.price}\n" +
|
||||
if (session.availableCount == 0) "Недоступно" else "${session.count}/${session.availableCount}",
|
||||
if (session.availableCount <= 0) "Недоступно" else "${session.count}/${session.availableCount}",
|
||||
color = MaterialTheme.colorScheme.onSecondary
|
||||
)
|
||||
}
|
||||
@ -219,7 +219,7 @@ private fun SessionListItem(
|
||||
|
||||
Spacer(modifier = Modifier.weight(1F))
|
||||
|
||||
if (session.availableCount != 0) {
|
||||
if (session.availableCount > 0) {
|
||||
IconButton(
|
||||
enabled = session.count != 1,
|
||||
onClick = { onChangeCount(session, session.count - 1) }
|
||||
|
@ -51,7 +51,7 @@ class CartViewModel(
|
||||
actionSuccess = {
|
||||
val orderId = orderRepository.insertOrder(Order(0, userId, LocalDateTime.now()))
|
||||
cart.forEach { session ->
|
||||
if (session.availableCount != 0) {
|
||||
if (session.availableCount > 0) {
|
||||
orderSessionRepository.insertOrderSession(
|
||||
OrderSessionCrossRef(
|
||||
orderId.toInt(),
|
||||
|
Loading…
Reference in New Issue
Block a user