From 5ddae470ce5ffbf8d6bb1bedc3b6b411aff802bc Mon Sep 17 00:00:00 2001 From: Guillermo Serrahima Date: Wed, 4 Feb 2026 12:17:14 +0100 Subject: Added dynamic calculation of processed messages --- velascobot2/database.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'velascobot2/database.py') diff --git a/velascobot2/database.py b/velascobot2/database.py index 582495f..8be2b8c 100644 --- a/velascobot2/database.py +++ b/velascobot2/database.py @@ -154,6 +154,20 @@ class Database: return rows + def get_chat_vocab_count(self, chat_id: str) -> int: + with _SQLiteContextMgr(database=self.db_name) as db: + result = db.execute( + "SELECT SUM(count) FROM vocab WHERE chat_id = ?", (chat_id,) + ).fetchone()[0] + return result or 0 + + def get_chat_graph_count(self, chat_id: str) -> int: + with _SQLiteContextMgr(database=self.db_name) as db: + result = db.execute( + "SELECT SUM(count) FROM graphics WHERE chat_id = ?", (chat_id,) + ).fetchone()[0] + return result or 0 + def get_graphics(self, chat_id: str): with _SQLiteContextMgr(database=self.db_name) as db: rows = db.execute( -- cgit v1.2.3