diff --git a/cogs/ShiftLogging.py b/cogs/ShiftLogging.py index 26653abd..1a0df80c 100644 --- a/cogs/ShiftLogging.py +++ b/cogs/ShiftLogging.py @@ -791,7 +791,7 @@ async def shift_leaderboard(self, ctx: commands.Context, *, type: str = None): else: return - all_staff = [{"id": None, "total_seconds": 0}] + all_staff = [] async def load_leaderboard(shift_type=None, batch_size=25): pipeline = [ @@ -874,7 +874,7 @@ async def load_leaderboard(shift_type=None, batch_size=25): for index, i in enumerate(sorted_staff): try: - member = await ctx.guild.fetch_member(i["id"]) + member = await ctx.guild.fetch_member(i["user_id"]) except discord.NotFound: member = None # print(index) diff --git a/menus.py b/menus.py index 78e1589f..65e9963d 100644 --- a/menus.py +++ b/menus.py @@ -6311,6 +6311,12 @@ async def _manipulate_shift_time(self, message, op: typing.Literal["add", "subtr } chosen_operation = operations[op] + if self.contained_document is not None: + check_for_update = await bot.shift_management.shifts.find_by_id(ObjectId(self.shift['_id'])) + if check_for_update != self.shift: + self.shift = check_for_update + self.contained_document = await bot.shift_management.fetch_shift(self.shift['_id']) + if self.contained_document is not None: if self.contained_document.end_epoch == 0: await chosen_operation(self.contained_document.id, amount) @@ -6329,6 +6335,8 @@ async def _manipulate_shift_time(self, message, op: typing.Literal["add", "subtr ) await chosen_operation(oid, amount) await self.bot.shift_management.end_shift(oid, guild.id) + self.contained_document = None + self.shift = None @discord.ui.button(label="On-Duty", style=discord.ButtonStyle.green) async def on_duty_button(self, interaction: discord.Interaction, _: discord.Button):