[Plugin] balance: Fixed transaction filter issue, fixed reverse
* Filter by end now filters correctly * Reverse a transaction will now return correct reversal transaction
This commit is contained in:
parent
708a45d43c
commit
862bafbbd3
|
@ -47,9 +47,7 @@ def request_reset(user: User):
|
|||
logger.debug(f"New password reset request for {user.userid}")
|
||||
reset = _generate_password_reset(user)
|
||||
|
||||
subject = str(config["MESSAGES"]["password_subject"]).format(
|
||||
name=user.display_name, username=user.userid
|
||||
)
|
||||
subject = str(config["MESSAGES"]["password_subject"]).format(name=user.display_name, username=user.userid)
|
||||
text = str(config["MESSAGES"]["password_text"]).format(
|
||||
name=user.display_name,
|
||||
username=user.userid,
|
||||
|
@ -158,9 +156,7 @@ def find_user(uid_mail):
|
|||
if user:
|
||||
update_user(user)
|
||||
else:
|
||||
user = current_app.config["FG_AUTH_BACKEND"].find_user(
|
||||
uid_mail, uid_mail if mail else None
|
||||
)
|
||||
user = current_app.config["FG_AUTH_BACKEND"].find_user(uid_mail, uid_mail if mail else None)
|
||||
if user:
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
|
@ -190,9 +186,7 @@ def register(data):
|
|||
|
||||
reset = _generate_password_reset(user)
|
||||
|
||||
subject = str(config["MESSAGES"]["welcome_subject"]).format(
|
||||
name=user.display_name, username=user.userid
|
||||
)
|
||||
subject = str(config["MESSAGES"]["welcome_subject"]).format(name=user.display_name, username=user.userid)
|
||||
text = str(config["MESSAGES"]["welcome_text"]).format(
|
||||
name=user.display_name,
|
||||
username=user.userid,
|
||||
|
|
|
@ -105,7 +105,7 @@ def get_transactions(user, start=None, end=None, limit=None, offset=None):
|
|||
if start:
|
||||
query = query.filter(start <= Transaction.time)
|
||||
if end:
|
||||
query = query.filter(Transaction.time >= end)
|
||||
query = query.filter(Transaction.time <= end)
|
||||
query = query.order_by(Transaction.time.desc())
|
||||
if offset is not None:
|
||||
query = query.offset(offset)
|
||||
|
@ -124,7 +124,7 @@ def reverse_transaction(transaction: Transaction, author: User):
|
|||
if transaction.reversal_:
|
||||
raise Conflict
|
||||
reversal = send(transaction.receiver_, transaction.sender_, transaction.amount, author)
|
||||
reversal.reversal_ = transaction
|
||||
reversal.original_ = transaction
|
||||
transaction.reversal = reversal
|
||||
db.session.commit()
|
||||
return reversal
|
||||
|
|
Loading…
Reference in New Issue