Update utils/file_initializer.py
Browse files- utils/file_initializer.py +5 -13
utils/file_initializer.py
CHANGED
@@ -1,24 +1,16 @@
|
|
1 |
import os
|
2 |
import pandas as pd
|
3 |
-
import json
|
4 |
|
5 |
CUSTOMERS_FILE = "database/customers.xlsx"
|
6 |
MENU_FILE = "database/menu.xlsx"
|
7 |
ORDERS_FILE = "database/orders.xlsx"
|
8 |
-
CONFIG_FILE = "utils/config.json"
|
9 |
|
10 |
def initialize_files():
|
|
|
|
|
11 |
if not os.path.exists(CUSTOMERS_FILE):
|
12 |
-
pd.DataFrame(columns=["Name", "Email", "Password"
|
13 |
if not os.path.exists(MENU_FILE):
|
14 |
-
pd.DataFrame(columns=["
|
15 |
if not os.path.exists(ORDERS_FILE):
|
16 |
-
pd.DataFrame(columns=["Table
|
17 |
-
if not os.path.exists(CONFIG_FILE):
|
18 |
-
config = {
|
19 |
-
"spice_levels": ["Mild", "Medium", "High"],
|
20 |
-
"preferences": ["Vegetarian", "Vegan", "Halal", "Full Menu"],
|
21 |
-
"occasions": ["Birthday", "Anniversary", "Other"]
|
22 |
-
}
|
23 |
-
with open(CONFIG_FILE, "w") as f:
|
24 |
-
json.dump(config, f)
|
|
|
1 |
import os
|
2 |
import pandas as pd
|
|
|
3 |
|
4 |
CUSTOMERS_FILE = "database/customers.xlsx"
|
5 |
MENU_FILE = "database/menu.xlsx"
|
6 |
ORDERS_FILE = "database/orders.xlsx"
|
|
|
7 |
|
8 |
def initialize_files():
|
9 |
+
if not os.path.exists("database"):
|
10 |
+
os.makedirs("database")
|
11 |
if not os.path.exists(CUSTOMERS_FILE):
|
12 |
+
pd.DataFrame(columns=["Name", "Email", "Password"]).to_excel(CUSTOMERS_FILE, index=False)
|
13 |
if not os.path.exists(MENU_FILE):
|
14 |
+
pd.DataFrame(columns=["Item", "Category", "Price"]).to_excel(MENU_FILE, index=False)
|
15 |
if not os.path.exists(ORDERS_FILE):
|
16 |
+
pd.DataFrame(columns=["Table", "Customer", "OrderDetails", "TotalAmount"]).to_excel(ORDERS_FILE, index=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|