Add POI feature and imporve the overall backend implementation
This commit is contained in:
@@ -115,8 +115,14 @@ class InventoryService:
|
||||
|
||||
response = IngredientResponse(**ingredient_dict)
|
||||
response.current_stock = stock_totals['total_available']
|
||||
response.is_low_stock = stock_totals['total_available'] <= ingredient.low_stock_threshold
|
||||
response.needs_reorder = stock_totals['total_available'] <= ingredient.reorder_point
|
||||
response.is_low_stock = (
|
||||
stock_totals['total_available'] <= ingredient.low_stock_threshold
|
||||
if ingredient.low_stock_threshold is not None else False
|
||||
)
|
||||
response.needs_reorder = (
|
||||
stock_totals['total_available'] <= ingredient.reorder_point
|
||||
if ingredient.reorder_point is not None else False
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
@@ -171,8 +177,14 @@ class InventoryService:
|
||||
|
||||
response = IngredientResponse(**ingredient_dict)
|
||||
response.current_stock = stock_totals['total_available']
|
||||
response.is_low_stock = stock_totals['total_available'] <= updated_ingredient.low_stock_threshold
|
||||
response.needs_reorder = stock_totals['total_available'] <= updated_ingredient.reorder_point
|
||||
response.is_low_stock = (
|
||||
stock_totals['total_available'] <= updated_ingredient.low_stock_threshold
|
||||
if updated_ingredient.low_stock_threshold is not None else False
|
||||
)
|
||||
response.needs_reorder = (
|
||||
stock_totals['total_available'] <= updated_ingredient.reorder_point
|
||||
if updated_ingredient.reorder_point is not None else False
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
@@ -214,8 +226,14 @@ class InventoryService:
|
||||
|
||||
response = IngredientResponse(**ingredient_dict)
|
||||
response.current_stock = stock_totals['total_available']
|
||||
response.is_low_stock = stock_totals['total_available'] <= ingredient.low_stock_threshold
|
||||
response.needs_reorder = stock_totals['total_available'] <= ingredient.reorder_point
|
||||
response.is_low_stock = (
|
||||
stock_totals['total_available'] <= ingredient.low_stock_threshold
|
||||
if ingredient.low_stock_threshold is not None else False
|
||||
)
|
||||
response.needs_reorder = (
|
||||
stock_totals['total_available'] <= ingredient.reorder_point
|
||||
if ingredient.reorder_point is not None else False
|
||||
)
|
||||
|
||||
responses.append(response)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user