From 0a1050d5d5a830051ab23589c3370681b92c317c Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Wed, 10 Jul 2024 12:15:26 +0330 Subject: [PATCH] fix: reducing user id fetching db call! --- discord_analyzer/analyzer/analyzer_heatmaps.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/discord_analyzer/analyzer/analyzer_heatmaps.py b/discord_analyzer/analyzer/analyzer_heatmaps.py index 76de1c8..e4c5b1f 100644 --- a/discord_analyzer/analyzer/analyzer_heatmaps.py +++ b/discord_analyzer/analyzer/analyzer_heatmaps.py @@ -100,6 +100,10 @@ def analysis_heatmap(self, guildId: str, from_start: bool = False): guildId=guildId, ) + account_list = get_userids( + db_mongo_client=self.DB_connections.mongoOps.mongo_db_access.db_mongo_client, + guildId=guildId, + ) while last_date.date() < datetime.now().date(): entries = rawinfo_c.get_day_entries(last_date, "ANALYZER HEATMAPS: ") if len(entries) == 0: @@ -108,10 +112,6 @@ def analysis_heatmap(self, guildId: str, from_start: bool = False): continue prepared_list = [] - account_list = get_userids( - db_mongo_client=self.DB_connections.mongoOps.mongo_db_access.db_mongo_client, - guildId=guildId, - ) for entry in entries: if "replied_user" not in entry: @@ -134,7 +134,10 @@ def analysis_heatmap(self, guildId: str, from_start: bool = False): "mess_type": entry["type"], } ) - if entry["author"] not in account_list: + if ( + entry["author"] not in account_list + and entry["author"] not in bot_ids + ): account_list.append(entry["author"]) if entry["user_mentions"] is not None: