Skip to content

Commit

Permalink
Merge pull request #101 from TogetherCrew/bugfix/100-intensive-heatmaps
Browse files Browse the repository at this point in the history
fix: reducing user id fetching db call!
  • Loading branch information
cyri113 authored Jul 10, 2024
2 parents 547bc66 + 0a1050d commit ab1a50c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions discord_analyzer/analyzer/analyzer_heatmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit ab1a50c

Please sign in to comment.