From 49bdaef4f2fa9b85ce45f6cab8e0c0fe39230428 Mon Sep 17 00:00:00 2001 From: i_iMikey <67828573+MikeyUsersREC@users.noreply.github.com> Date: Thu, 4 Jan 2024 23:52:35 +0000 Subject: [PATCH] Update ShiftLogging.py --- cogs/ShiftLogging.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cogs/ShiftLogging.py b/cogs/ShiftLogging.py index f3531ea6..8eac25bc 100644 --- a/cogs/ShiftLogging.py +++ b/cogs/ShiftLogging.py @@ -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 @@ -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