Update routes/stylist.py
Browse files- routes/stylist.py +10 -2
routes/stylist.py
CHANGED
@@ -214,8 +214,16 @@ def get_monthly_revenue(account_id: str) -> Dict[str, Any]:
|
|
214 |
else:
|
215 |
growth_percentage = 100 if current_amount > 0 else 0
|
216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
current_month_data["growth"] = {
|
218 |
-
"status":
|
219 |
"percentage": round(growth_percentage, 1),
|
220 |
"formatted": f"{round(growth_percentage, 1)}%"
|
221 |
}
|
@@ -230,7 +238,7 @@ def get_monthly_revenue(account_id: str) -> Dict[str, Any]:
|
|
230 |
"monthly_data": list(monthly_data.values()),
|
231 |
"total_last_6_months": 0
|
232 |
}
|
233 |
-
|
234 |
def format_subscription_date(created_at_str: str) -> str:
|
235 |
"""Format the subscription date to the requested format: e.g. '13th January 2025'"""
|
236 |
try:
|
|
|
214 |
else:
|
215 |
growth_percentage = 100 if current_amount > 0 else 0
|
216 |
|
217 |
+
# Define o status baseado no valor do crescimento
|
218 |
+
if growth_percentage > 0:
|
219 |
+
status = "up"
|
220 |
+
elif growth_percentage < 0:
|
221 |
+
status = "down"
|
222 |
+
else:
|
223 |
+
status = "neutral"
|
224 |
+
|
225 |
current_month_data["growth"] = {
|
226 |
+
"status": status,
|
227 |
"percentage": round(growth_percentage, 1),
|
228 |
"formatted": f"{round(growth_percentage, 1)}%"
|
229 |
}
|
|
|
238 |
"monthly_data": list(monthly_data.values()),
|
239 |
"total_last_6_months": 0
|
240 |
}
|
241 |
+
|
242 |
def format_subscription_date(created_at_str: str) -> str:
|
243 |
"""Format the subscription date to the requested format: e.g. '13th January 2025'"""
|
244 |
try:
|