i think it works
This commit is contained in:
@@ -201,6 +201,15 @@ class Database:
|
||||
result.append((proj.name or proj.worktree, ws_names, has_workspaces))
|
||||
return sorted(result)
|
||||
|
||||
def get_session_counts_by_project(self) -> dict:
|
||||
"""Return a dict of project_id -> active session count."""
|
||||
assert self.conn is not None
|
||||
cursor = self.conn.cursor()
|
||||
cursor.execute(
|
||||
"SELECT project_id, COUNT(*) FROM session WHERE time_archived IS NULL GROUP BY project_id"
|
||||
)
|
||||
return {row[0]: row[1] for row in cursor.fetchall()}
|
||||
|
||||
def get_session(self, session_id: str) -> Optional[Session]:
|
||||
"""Get a single session by ID."""
|
||||
sessions = self.get_sessions(include_archived=True)
|
||||
|
||||
Reference in New Issue
Block a user