Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -2
src/streamlit_app.py
CHANGED
|
@@ -83,8 +83,12 @@ elif operation == "Add Customer":
|
|
| 83 |
else:
|
| 84 |
# Auto-generate ID based on existing customers count
|
| 85 |
try:
|
| 86 |
-
existing_customers = requests.get("https://ritesh1035-cms-apis.hf.space").json()
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
except:
|
| 89 |
customer_id = 1
|
| 90 |
|
|
|
|
| 83 |
else:
|
| 84 |
# Auto-generate ID based on existing customers count
|
| 85 |
try:
|
| 86 |
+
existing_customers = requests.get("https://ritesh1035-cms-apis.hf.space/Customer").json()
|
| 87 |
+
if existing_customers:
|
| 88 |
+
max_id = max(customer.get('id', 0) for customer in existing_customers)
|
| 89 |
+
customer_id = max_id + 1
|
| 90 |
+
else:
|
| 91 |
+
customer_id = 1
|
| 92 |
except:
|
| 93 |
customer_id = 1
|
| 94 |
|