Skip to content

Commit d1e6642

Browse files
committed
fixed timezone
1 parent 9752a1f commit d1e6642

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

ai_ta_backend/database/sql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ def getPreAssignedAPIKeys(self, email: str):
158158
return self.supabase_client.table("pre_authorized_api_keys").select("*").contains("emails", '["' + email + '"]').execute()
159159

160160
def getConversationsCreatedAtByCourse(self, course_name: str):
161-
return self.supabase_client.table("llm-convo-monitor").select("created_at").eq("course_name", course_name).order("created_at", desc=False).execute()
161+
return self.supabase_client.table("llm-convo-monitor").select("created_at").eq("course_name", course_name).execute()

ai_ta_backend/service/retrieval_service.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,15 @@ def format_for_json(self, found_docs: List[Document]) -> List[Dict]:
548548
def getConversationStats(self, course_name: str):
549549
"""
550550
Fetches conversation data from the database and groups them by day, hour, and weekday.
551+
552+
Args:
553+
course_name (str)
554+
555+
Returns:
556+
dict: Aggregated conversation counts:
557+
- 'per_day': By date (YYYY-MM-DD).
558+
- 'per_hour': By hour (0-23).
559+
- 'per_weekday': By weekday (Monday-Sunday).
551560
"""
552561
response = self.sqlDb.getConversationsCreatedAtByCourse(course_name)
553562

@@ -589,11 +598,10 @@ def getConversationHeatmapByHour(self, course_name: str):
589598
Fetches conversation data and groups them into a heatmap by day of the week and hour (Central Time).
590599
591600
Args:
592-
course_name (str): The name of the course.
601+
course_name (str)
593602
594603
Returns:
595-
dict: A nested dictionary where the outer key is the day of the week (e.g., "Monday"),
596-
and the inner key is the hour of the day (0-23), and the value is the count of conversations.
604+
dict: A nested dictionary with days of the week as outer keys and hours (0-23) as inner keys, where values are conversation counts.
597605
"""
598606
response = self.sqlDb.getConversationsCreatedAtByCourse(course_name)
599607
central_tz = pytz.timezone('America/Chicago')

0 commit comments

Comments
 (0)