Skip to content

Commit

Permalink
Update ShiftLogging.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyUsersREC authored Jan 4, 2024
1 parent 992169a commit 49bdaef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cogs/ShiftLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,15 @@ async def shift_leaderboard(self, ctx: commands.Context, *, type: str = None):
"id": document["UserID"],
"total_seconds": total_seconds,
"moderations": moderations,
"lowest_time": document['StartEpoch']
}
)
else:
for item in all_staff:
if item["id"] == document["UserID"]:
if item['lowest_time'] > document['StartEpoch']:
item['lowest_time'] = document['StartEpoch']

item["total_seconds"] += total_seconds
item["moderations"] += moderations

Expand All @@ -872,7 +876,7 @@ async def shift_leaderboard(self, ctx: commands.Context, *, type: str = None):

for index, item in enumerate(all_staff):
if item.get('moderations') == 0:
item['moderations'] = await self.bot.punishments.db.count_documents({"ModeratorID": item['id']})
item['moderations'] = await self.bot.punishments.db.count_documents({"ModeratorID": item['id'], "Guild": ctx.guild.id, "Epoch": {"$gt": item['lowest_time']}})
all_staff[index] = item


Expand Down

0 comments on commit 49bdaef

Please sign in to comment.