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

Bug: Account group total value in sidebar ignores accounts in foreign currency #724

Open
jakubkottnauer opened this issue May 7, 2024 · 4 comments
Labels
🐛 Bug Something isn't working

Comments

@jakubkottnauer
Copy link
Contributor

Describe the bug
The balance sums shown next to the collapsible account groups in the sidebar don't include accounts in foreign currencies, if today's exchange rates for those currencies are missing in the database.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new account in a foreign (= different from your base) currency (one that you haven't used before) with a non-zero balance
  2. Observe that in the sidebar, the balance of the new account isn't included in the sum for that account type group

Expected behavior
Account group balances in the sidebar should take foreign currencies into account. In the screenshot below, the number next to Other Liability should be roughly $1020.00 (200 SEK ~ 20 USD)

Screenshots / Recordings
Screenshot 2024-05-07 at 22 31 03

Additional context
The issue is caused by a missing exchange rate when this check is performed:

elsif rate = ExchangeRate.find_rate(from: currency, to: other_currency, date: date)

Perhaps we should sync the account right after it's created? Or at the very least call account.sync_exchange_rates. We'll also need to fetch exchange rates periodically or upon login, otherwise the bug reappears the next day.

@jakubkottnauer jakubkottnauer added the 🐛 Bug Something isn't working label May 7, 2024
@zachgoll
Copy link
Collaborator

zachgoll commented May 8, 2024

@jakubkottnauer since populating exchange rates requires a user to potentially spend money, the app needs to assume that rates cannot always be populated in full and have sensible ways of handling that.

The behavior we're seeing here is the original intention, but may not be the best way to handle it.

What do you think is the best way to display the data when a user has not synced exchange rates?

@zachgoll
Copy link
Collaborator

zachgoll commented May 8, 2024

I haven't quite gotten to this yet, but my thinking was that in these scenarios where user action is required to fix the data, we display global warnings to alert them that their data is not 100% correct and they need to do something to fix it:
CleanShot 2024-05-08 at 08 40 08

@jakubkottnauer
Copy link
Contributor Author

Gotcha, yes, I think what you suggest would be fine. Maybe we could, in addition to the user action prompt, also show a little icon next to all the balances that are impacted by the missing exchange rate (as an example, in your screenshot the USD accounts in the sidebar would be shown normally, but foreign currency accounts would have the icon next to the balance)

@zachgoll
Copy link
Collaborator

zachgoll commented May 9, 2024

@jakubkottnauer I'd agree with that—having granular "hints" that lead the user to full explanations / troubleshooting guides would be ideal here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants