Skip to content

Commit

Permalink
Merge pull request #103 from Vatsim-Scandinavia/feature/training-roles
Browse files Browse the repository at this point in the history
Fixed unbooking
  • Loading branch information
Marko259 authored Sep 28, 2024
2 parents e0aa86d + 07fe1b4 commit dacd773
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cogs/staffings.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,18 @@ async def unbook(self, interaction: discord.Integration):
bookings = DB.select(table='positions', columns=['booking_id'], where=['user', 'event'], value={'user': f'<@{usernick}>', 'event': event[0]}, amount='all')
cancel = False
for booking in bookings:
request = await Booking.delete_booking(self, int(cid[0]), int(booking[0]))
if request == 200:
if isinstance(int(booking[0]) , int):
request = await Booking.delete_booking(self, int(cid[0]), int(booking[0]))
if request == 200:
DB.update(self=self, table='positions', columns=['booking_id', 'user',], values={'booking_id': '', 'user': ''}, where=['user', 'event'], value={'user': f'<@{usernick}>', 'event': event[0]}, limit=1)
await StaffingAsync._updatemessage(self, event[0])
cancel = True
else:
await ctx.send(f"<@{usernick}> Cancelling failed, Control Center responded with error {request}, please try again later", delete_after=5)
else:
DB.update(self=self, table='positions', columns=['booking_id', 'user',], values={'booking_id': '', 'user': ''}, where=['user', 'event'], value={'user': f'<@{usernick}>', 'event': event[0]}, limit=1)
await StaffingAsync._updatemessage(self, event[0])
cancel = True
else:
await ctx.send(f"<@{usernick}> Cancelling failed, Control Center responded with error {request}, please try again later", delete_after=5)

if cancel == True:
await ctx.send(f"<@{usernick}> Confirmed cancelling of your booking(s)!", delete_after=5)
Expand Down

0 comments on commit dacd773

Please sign in to comment.