opus pass 2
This commit is contained in:
@@ -67,7 +67,8 @@ def record_presence_event(user_uuid: str, event_type: str, timestamp: datetime):
|
||||
if not presence:
|
||||
return
|
||||
|
||||
history = json.loads(presence.get("presence_history", "[]"))
|
||||
raw_history = presence.get("presence_history", [])
|
||||
history = json.loads(raw_history) if isinstance(raw_history, str) else raw_history
|
||||
|
||||
# Add new event
|
||||
history.append({"type": event_type, "timestamp": timestamp.isoformat()})
|
||||
@@ -88,7 +89,8 @@ def calculate_typical_wake_time(user_uuid: str) -> Optional[time]:
|
||||
if not presence:
|
||||
return None
|
||||
|
||||
history = json.loads(presence.get("presence_history", "[]"))
|
||||
raw_history = presence.get("presence_history", [])
|
||||
history = json.loads(raw_history) if isinstance(raw_history, str) else raw_history
|
||||
if len(history) < 3:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user