Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Offline Currency Payout Improvements #2797

Open
wants to merge 11 commits into
base: v5
Choose a base branch
from

Conversation

phroggster
Copy link
Collaborator

@phroggster phroggster commented Sep 10, 2024

Description of the Change

  • Currency payouts would stop paying out while offline once any currency had a zero offline payout or was left at the defaults.
    • Changed it to keep checking additional currencies.
  • As well, the model's offline property is an empty string if the checkbox is checked, then unchecked in the add or edit currency model (addOrEditCurrency.js/html).
    • I don't want to expand the Currency type definition in currency-access.ts, but we might want to. Edit: I didn't.
    • Fixed this in (attempt two, in) the controller's save function to undefine the value if it's null or empty.

Applicable Issues

#2796. #2801

Testing

Minimal, but yes. Verified bugs existed, then verified that this fixed them.

Screenshots

N/A

- Currency payouts would stop paying out while offline once any currency
  had a zero offline payout.
- Changed it to keep checking additional currencies.
- Issue crowbartools#2796
- Checking then unchecking the Offline Payout checkbox in the add or
  edit currency dialog results in the offline property being assigned to
  an empty string.
- This conflicts with the type definition of a Currency in
  currency-access.ts.
- So pay special attention to it potentially being an empty string.
- See issue crowbartools#2801
@phroggster phroggster changed the title fix: Offline Currency Payout Improvement fix: Offline Currency Payout Improvements Sep 11, 2024
@phroggster
Copy link
Collaborator Author

phroggster commented Sep 11, 2024

Ebiggz / et. al: will you let me know if you'd rather I actually overwrite the model's empty string .offline property to a 0 or null in addOrEditCurrency.js when it's saving the currency instead of this approach? I feel hackish about any answer to this at this point, and am unsure of what's the least-worst solution.

This reverts commit 197fe92.
Going to edit the currency add/edit controller instead. It's better for
everyone.
- Checking then unchecking the offline payout option in an add or edit
  currency modal will assign an empty string to the data model.
- The data model is typed as a Number.
- This typing is exposed to external scripts.
- So trim the null or empty string on addOrEditCurrency controller save
  to prevent a string from getting through.
- See issue crowbartools#2801.
@phroggster
Copy link
Collaborator Author

I have reverted my prior 2801 commit, and gone ahead and fixed it properly. Retested with every variation that I could come up with to break it, and this works better, and is better for the outside world.

CaveMobster and others added 4 commits September 27, 2024 14:05
- Remove the empty string offline currency payout upon read.
  - Immediately re-write the file without the poorly-typed value.
- Remove the empty string offline currency payout upon import, before it
  actually gets added or updated.
- currency-access.ts should also catch nulls, while 0's are OK.
- currency-manager.ts is much more concise with a boolean nullish.
- As-is currency.service.js...
- ... which also had two lint warnings in it that got buffed out.
- addOrEditCurrency.js can also use a boolean nullish.
- Buffed out the two arrow-parens lint warnings in there as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants