Fix admin order save#2501
Open
alicecoordinator wants to merge 10 commits into
Open
Conversation
In the previous implementation, every time the payout_amount method was called, the swap failure reason was logged in the order. This method was called in the order GET method of the API, which led to logging the failure reason dozens of times for some orders. This commit splits the payout_amount calculation from the context generation. Now the logging happens only in the finalize_contract method, and this can only happen once.
`slashed_robot_log` was not expanded so it resulted in a literal
`{slashed_robot.id}` ecc. and `_logs` in `api/admin.py` threw an
exception here:
```python
with_hyperlinks = objects_to_hyperlinks(obj.logs)
try:
html_logs = format_html(
f'<table style="width: 100%">{with_hyperlinks}</table>'
)
except Exception as e:
html_logs = f"An error occurred while formatting the parsed logs as HTML. Exception {e}"
```
Also removed a trailing parenthesis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
It is not possible currently to edit orders in the admin panel. Trying to do so leads to the message "Please correct the error below.", but no field is indicated as erroneous.
The reason is that the payment_hash field of LN payments is not being rendered in the form.
Checklist before merging
pip install pre-commit, thenpre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.