Skip to content

Commit

Permalink
Fixed banking update SQL queries
Browse files Browse the repository at this point in the history
Signed-off-by: tiksan <>
  • Loading branch information
tiksan committed Nov 19, 2023
1 parent 98ad270 commit be3316f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
11 changes: 6 additions & 5 deletions controllers/faction/banking.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,13 @@ def fulfill(guid: str):
return utils.handle_discord_error(e)

if current_user.is_authenticated:
withdrawal.fulfiller = current_user.tid
Withdrawal.update(fulfiller=current_user.tid, time_fulfilled=datetime.datetime.utcnow(), status=1).where(
Withdrawal.wid == withdrawal.wid
).execute()
else:
withdrawal.fulfiller = -1

withdrawal.time_fulfilled = datetime.datetime.utcnow()
withdrawal.save()
Withdrawal.update(fulfiller=-1, time_fulfilled=datetime.datetime.utcnow(), status=1).where(
Withdrawal.wid == withdrawal.wid
).execute()

if requester.discord_id not in (None, "", 0):
send_dm.delay(
Expand Down
14 changes: 6 additions & 8 deletions skynet/commands/faction/cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,9 @@ def cancel_command(interaction, *args, **kwargs):
},
}

withdrawal.status = 2
withdrawal.fulfiller = user.tid
withdrawal.time_fulfilled = datetime.datetime.utcnow()
withdrawal.save()
Withdrawal.update(status=2, fulfiller=user.tid, time_fulfilled=datetime.datetime.utcnow()).where(
Withdrawal.wid == withdrawal.wid
).execute()

if requester.discord_id not in (None, 0):
try:
Expand Down Expand Up @@ -683,10 +682,9 @@ def cancel_button(interaction, *args, **kwargs):
},
}

withdrawal.status = 2
withdrawal.fulfiller = user.tid
withdrawal.time_fulfilled = datetime.datetime.utcnow()
withdrawal.save()
Withdrawal.update(status=2, fulfiller=user.tid, time_fulfilled=datetime.datetime.utcnow()).where(
Withdrawal.wid == withdrawal.wid
).execute()

if requester.discord_id not in (None, 0):
try:
Expand Down
14 changes: 6 additions & 8 deletions skynet/commands/faction/fulfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,9 @@ def fulfill_command(interaction, *args, **kwargs):
},
}

withdrawal.status = 1
withdrawal.fulfiller = user.tid
withdrawal.time_fulfilled = datetime.datetime.utcnow()
withdrawal.save()
Withdrawal.update(status=1, fulfiller=user.tid, time_fulfilled=datetime.datetime.utcnow()).where(
Withdrawal.wid == withdrawal.wid
).execute()

if requester.discord_id not in (None, 0):
try:
Expand Down Expand Up @@ -688,10 +687,9 @@ def fulfill_button(interaction, *args, **kwargs):
},
}

withdrawal.status = 1
withdrawal.fulfiller = user.tid
withdrawal.time_fulfilled = datetime.datetime.utcnow()
withdrawal.save()
Withdrawal.update(status=1, fulfiller=user.tid, time_fulfilled=datetime.datetime.utcnow()).where(
Withdrawal.wid == withdrawal.wid
).execute()

if requester.discord_id not in (None, "", 0):
try:
Expand Down

0 comments on commit be3316f

Please sign in to comment.