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