fix: replace pytz with zoneinfo, fix predictive insights list/dict bug
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m15s
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m15s
This commit is contained in:
parent
76b514d521
commit
7dae32d206
@ -2626,14 +2626,13 @@ class OnCallAdminSchedule(UUIDModel, TimeStampedModel):
|
||||
Returns:
|
||||
bool: True if within working hours, False otherwise
|
||||
"""
|
||||
import pytz
|
||||
from datetime import time as datetime_time
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
if check_datetime is None:
|
||||
check_datetime = timezone.now()
|
||||
|
||||
# Convert to schedule timezone
|
||||
tz = pytz.timezone(self.timezone)
|
||||
tz = ZoneInfo(self.timezone)
|
||||
if timezone.is_aware(check_datetime):
|
||||
local_time = check_datetime.astimezone(tz)
|
||||
else:
|
||||
|
||||
@ -301,11 +301,12 @@ def generate_predictive_insights():
|
||||
predictive_service = PredictiveAnalyticsService()
|
||||
result = predictive_service.generate_predictive_insights()
|
||||
|
||||
logger.info(f"Predictive insights generated: {result.get('insights_created', 0)} insights created")
|
||||
insights_created = len(result) if isinstance(result, list) else result.get("insights_created", 0)
|
||||
logger.info(f"Predictive insights generated: {insights_created} insights created")
|
||||
return {
|
||||
"status": "success",
|
||||
"insights_created": result.get("insights_created", 0),
|
||||
"insights_updated": result.get("insights_updated", 0),
|
||||
"insights_created": insights_created,
|
||||
"insights_updated": result.get("insights_updated", 0) if isinstance(result, dict) else 0,
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user