Spaces:
Sleeping
Sleeping
changed testing parameters to stable parameters
Browse files- gamification/logic.py +5 -3
gamification/logic.py
CHANGED
|
@@ -14,13 +14,14 @@ def caculate_rate_change_func(c0,c1,days_ago):
|
|
| 14 |
if c1 > 0:
|
| 15 |
# If there are customers now, but no customers initially (c0 is 0),
|
| 16 |
# we consider it as infinite growth or 100% growth
|
| 17 |
-
|
|
|
|
| 18 |
elif c1 == 0:
|
| 19 |
# If both c0 and c1 are zero, there is no change
|
| 20 |
return {"daysAgo":days_ago,"totalCustomers": c1, "GrowthRate": 0.0, "GrowthRateType": "neutral"}
|
| 21 |
else:
|
| 22 |
# This case is for when c1 < 0, but it's unlikely in a customer count scenario.
|
| 23 |
-
return {"daysAgo":days_ago,"totalCustomers": c1, "GrowthRate": -
|
| 24 |
|
| 25 |
elif c1 > c0:
|
| 26 |
# Positive growth rate: c1 > c0
|
|
@@ -246,7 +247,8 @@ def get_all_feedback_func() -> List[UserFeedback]:
|
|
| 246 |
|
| 247 |
|
| 248 |
def get_all_customer_info()->List[CustomerInfo]:
|
| 249 |
-
db_uri
|
|
|
|
| 250 |
db_name = "crayonics"
|
| 251 |
collection_name = "users"
|
| 252 |
client = MongoClient(db_uri)
|
|
|
|
| 14 |
if c1 > 0:
|
| 15 |
# If there are customers now, but no customers initially (c0 is 0),
|
| 16 |
# we consider it as infinite growth or 100% growth
|
| 17 |
+
print("here")
|
| 18 |
+
return {"daysAgo":days_ago,"totalCustomers": c1, "GrowthRate": 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, "GrowthRateType": "positive"}
|
| 19 |
elif c1 == 0:
|
| 20 |
# If both c0 and c1 are zero, there is no change
|
| 21 |
return {"daysAgo":days_ago,"totalCustomers": c1, "GrowthRate": 0.0, "GrowthRateType": "neutral"}
|
| 22 |
else:
|
| 23 |
# This case is for when c1 < 0, but it's unlikely in a customer count scenario.
|
| 24 |
+
return {"daysAgo":days_ago,"totalCustomers": c1, "GrowthRate": -99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, "GrowthRateType": "negative"}
|
| 25 |
|
| 26 |
elif c1 > c0:
|
| 27 |
# Positive growth rate: c1 > c0
|
|
|
|
| 247 |
|
| 248 |
|
| 249 |
def get_all_customer_info()->List[CustomerInfo]:
|
| 250 |
+
db_uri=MONGO_URI
|
| 251 |
+
# db_uri = "mongodb+srv://groupcresearchseminar:[email protected]/?retryWrites=true&w=majority&appName=Cluster0"
|
| 252 |
db_name = "crayonics"
|
| 253 |
collection_name = "users"
|
| 254 |
client = MongoClient(db_uri)
|