Fix: Guestbook would not let you seat anyone who has any old bill.
Fix: Only create a new temporal product when there is some change in the data.
This commit is contained in:
parent
5534b3983d
commit
8b2d15b9e1
@ -172,12 +172,28 @@ def update_route(
|
||||
)
|
||||
)
|
||||
).scalar_one()
|
||||
if (
|
||||
item.name == data.name
|
||||
and item.units == data.units
|
||||
and item.menu_category_id == data.menu_category.id_
|
||||
and item.sale_category_id == data.sale_category.id_
|
||||
and item.price == data.price
|
||||
and item.has_happy_hour == data.has_happy_hour
|
||||
and item.is_not_available == data.is_not_available
|
||||
):
|
||||
if item.quantity != data.quantity or item.sort_order != data.sort_order:
|
||||
item.quantity = data.quantity
|
||||
item.sort_order = data.sort_order
|
||||
db.commit()
|
||||
# The product is identical. No need for a new one
|
||||
return None
|
||||
if item.valid_till is not None:
|
||||
# Allow adding a product here splitting the valid from and to, but not implemented right now
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Product has been invalidated",
|
||||
)
|
||||
|
||||
if item.valid_from == date_: # Update the product as valid from the the same
|
||||
item.name = data.name
|
||||
item.units = data.units
|
||||
@ -187,6 +203,7 @@ def update_route(
|
||||
item.has_happy_hour = data.has_happy_hour
|
||||
item.is_not_available = data.is_not_available
|
||||
item.quantity = data.quantity
|
||||
item.sort_order = data.sort_order
|
||||
db.commit()
|
||||
return None
|
||||
else: # Create a new version of the product from the new details
|
||||
|
@ -58,7 +58,7 @@
|
||||
mat-icon-button
|
||||
[routerLink]="['/sales']"
|
||||
[queryParams]="{ guest: row.id }"
|
||||
*ngIf="!row.tableId && !row.voucherId"
|
||||
*ngIf="row.status === 'old' || (!row.tableId && !row.voucherId)"
|
||||
>
|
||||
<mat-icon>chair</mat-icon>
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user