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

Sort currencies by name as a second order #1216

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

alagos
Copy link
Contributor

@alagos alagos commented Sep 30, 2024

The currency sorting is very chaotic only relying on the "priority"
Screenshot 2024-09-30 at 6 30 10 PM
so I've also set the "name" as a second order parameter
Screenshot 2024-09-30 at 6 30 32 PM

@alagos
Copy link
Contributor Author

alagos commented Sep 30, 2024

BTW, related with the second screenshot, why does the "Belarusian Ruble" has a higher priority compared with other currencies? To me looks like an unintended error, so I was thinking to change it to 100 in this same PR, but maybe this Ruble is really very important in the world economy 🤷

@zachgoll
Copy link
Collaborator

zachgoll commented Sep 30, 2024

@alagos good idea, I think adding the name as a secondary sort is helpful.

In regards to the priorities of these currencies—there has not been a ton of work done around this yet and the few currencies that have been assigned a priority were a quick guess when we originally set up the list.

We'd be glad to accept any contribution that provides an updated priorities list given there is reasonable data to back up those changes.

@alagos
Copy link
Contributor Author

alagos commented Oct 1, 2024

Right, I'm not sure that I have in mind a reliable source of currency priorities (actually, I think is out of the scope of what I was thinking to fix here).

@ssjr
Copy link

ssjr commented Oct 1, 2024

I set up the project yesterday and started using it locally.
Set the default currency in http://localhost:3000/settings/preferences to "BRL". When I went to add accounts in http://localhost:3000/accounts the default currency was USD and I had to manually change it every time when creating an account.
image

image

Could it be like

  def currencies_for_select
    Money::Currency.all_instances.sort_by do |currency|
      family_currency = Current.family&.currency == currency.iso_code ? 0 : 1

      [ family_currency, currency.priority, currency.name ]
    end
  end

@zachgoll zachgoll merged commit fa3b1e0 into maybe-finance:main Oct 1, 2024
4 checks passed
@zachgoll
Copy link
Collaborator

zachgoll commented Oct 1, 2024

@ssjr auto-population of the family currency is fixed now:

e8eb4b0

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.

3 participants