Skip to content

Commit

Permalink
Fixing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeyUsersREC committed Jan 19, 2024
1 parent ae644fc commit 62a306c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cogs/ShiftLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 62a306c

Please sign in to comment.