SathvikGanta commited on
Commit
5242734
·
verified ·
1 Parent(s): bcfa5dd

Update components/cart.py

Browse files
Files changed (1) hide show
  1. components/cart.py +13 -13
components/cart.py CHANGED
@@ -1,19 +1,19 @@
1
- cart = [] # Store all cart items
2
 
3
- def add_to_cart(dish_name, spice_level, extras, instructions, quantity, menu_data):
4
- """Add selected item with options to the cart."""
5
- dish = menu_data[menu_data['Dish Name'] == dish_name].iloc[0]
6
- price = dish['Price']
7
- extras_cost = sum([float(extra.split('+ $')[-1]) for extra in extras]) if extras else 0
8
- total_price = (price + extras_cost) * quantity
9
-
10
- # Add to cart
11
- cart.append({
12
  "Dish": dish_name,
13
  "Spice Level": spice_level,
14
  "Extras": ", ".join(extras) if extras else "None",
15
  "Instructions": instructions,
16
  "Quantity": quantity,
17
- "Price": f"${total_price:.2f}"
18
- })
19
- return cart
 
 
 
 
 
 
 
1
+ cart = [] # Global cart
2
 
3
+ def add_to_cart(dish_name, spice_level, extras, instructions, quantity):
4
+ """Add selected item to the cart."""
5
+ item = {
 
 
 
 
 
 
6
  "Dish": dish_name,
7
  "Spice Level": spice_level,
8
  "Extras": ", ".join(extras) if extras else "None",
9
  "Instructions": instructions,
10
  "Quantity": quantity,
11
+ "Price": f"${(quantity * 10.0):.2f}" # Example price
12
+ }
13
+ cart.append(item)
14
+ return cart_data()
15
+
16
+ def cart_data():
17
+ """Return cart data."""
18
+ import pandas as pd
19
+ return pd.DataFrame(cart)