def updateOrderProduct(): total_price = 0 order_number = random.randint(0,999999) order = getOrderByCartStatus(session['user_id']) for i in OrderProduct.listOrderProductById(order.id): total_price += i.price*i.quantity Order.updateOrderStatus(order.id, OrderStatus.getNameStatus('Created').id, total_price, order_number) return make_response(jsonify({'message':'success'}),200)
def addOrderWithStatusCart(user_id): if Order.getOrderByStatus(user_id) is None: Order.add_order(user_id,date.today(), OrderStatus.getNameStatus('Cart').id)