Skip to content

Commit

Permalink
Merge pull request #104 from TogetherCrew/bugfix/100-intensive-heatmaps
Browse files Browse the repository at this point in the history
fix: making heatmaps less intensive!
  • Loading branch information
cyri113 authored Jul 10, 2024
2 parents 5051b1c + e55c227 commit 296189f
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions discord_analyzer/analyzer/analyzer_heatmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ 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 @@ -112,36 +108,44 @@ def analysis_heatmap(self, guildId: str, from_start: bool = False):
continue

prepared_list = []
account_list = []

for entry in entries:
if "replied_user" not in entry:
reply = ""
else:
reply = entry["replied_user"]
if reply not in account_list and reply not in bot_ids:
account_list.append(reply)

# eliminating bots
if entry["author"] not in bot_ids:
author = entry["author"]
mentioned_users = entry["user_mentions"]
if author not in bot_ids:
prepared_list.append(
{
# .strftime('%Y-%m-%d %H:%M'),
"datetime": entry["createdDate"],
"channel": entry["channelId"],
"author": entry["author"],
"author": author,
"replied_user": reply,
"user_mentions": entry["user_mentions"],
"user_mentions": mentioned_users,
"reactions": entry["reactions"],
"threadId": entry["threadId"],
"mess_type": entry["type"],
}
)
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:
for account in entry["user_mentions"]:
if author not in account_list:
account_list.append(author)

# Adding the interacting users
for users_reacting in entry["reactions"]:
for user in users_reacting.split(",")[:-1]:
if user not in account_list:
account_list.append(user)

if mentioned_users is not None:
for account in mentioned_users:
if account not in account_list and account not in bot_ids:
account_list.append(account)

Expand Down

0 comments on commit 296189f

Please sign in to comment.