Минорные фиксы

This commit is contained in:
Данила Мочалов 2023-12-03 20:25:58 +04:00
parent 963ef167c8
commit af6a0ffe3e
4 changed files with 7 additions and 6 deletions

View File

@ -24,6 +24,6 @@ interface OrderDao {
fun getByUserId(userId: Int): Flow<List<OrderWithProducts>> fun getByUserId(userId: Int): Flow<List<OrderWithProducts>>
@Query("select * from orders where orders.user_id =:userId and orders.order_status = 'Неоплачено'") @Query("select * from orders where orders.user_id =:userId and orders.order_status = 'Неоплачено'")
fun getUnpaidByUser(userId: Int) : Flow<OrderWithProducts> fun getUnpaidByUser(userId: Int) : Flow<OrderWithProducts>
@Query("select * from orders where orders.user_id =:userId and orders.order_status = 'Готовится'") @Query("select * from orders where orders.user_id =:userId and (orders.order_status = 'Готовится' or orders.order_status = 'Готово')")
fun getPaidByUser(userId: Int) : Flow<List<OrderWithProducts>> fun getPaidByUser(userId: Int) : Flow<List<OrderWithProducts>>
} }

View File

@ -7,5 +7,6 @@ data class OrderProductModelWithProduct(
@Embedded @Embedded
val orderProductModel: OrderProductModel, val orderProductModel: OrderProductModel,
@Relation(entity = ProductModel::class, parentColumn = "product_id", entityColumn = "id") @Relation(entity = ProductModel::class, parentColumn = "product_id", entityColumn = "id")
val product: ProductModel val product: ProductModel,
) )

View File

@ -199,7 +199,7 @@ fun PaidItem(order : OrderWithProducts) {
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
Text( Text(
text = order.orderWithProducts[index].orderProductModel.totalPrice.toString() + " руб.", text = (order.orderWithProducts[index].orderProductModel.quantity * order.orderWithProducts[index].product.price).toString() + " руб.",
fontFamily = NunitoFamily, fontFamily = NunitoFamily,
fontSize = 20.sp, fontSize = 20.sp,
modifier = Modifier.padding(top = 15.dp), modifier = Modifier.padding(top = 15.dp),
@ -250,7 +250,7 @@ fun CartItem(order : OrderWithProducts) {
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
Text( Text(
text = order.orderWithProducts[index].orderProductModel.totalPrice.toString() + " руб.", text = (order.orderWithProducts[index].orderProductModel.quantity * order.orderWithProducts[index].product.price).toString() + " руб.",
fontFamily = NunitoFamily, fontFamily = NunitoFamily,
fontSize = 18.sp, fontSize = 18.sp,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold

View File

@ -54,11 +54,11 @@ class UserViewModel @Inject constructor(
_registrationState.postValue(false) _registrationState.postValue(false)
return return
} }
if (login.length < 8 || login.length > 20) { if (login.length < 5 || login.length > 20) {
_registrationState.postValue(false) _registrationState.postValue(false)
return return
} }
if (password.length < 8 || password.length > 20) { if (password.length < 5 || password.length > 20) {
_registrationState.postValue(false) _registrationState.postValue(false)
return return
} }