Skip to content

Conversation

Sleapy31
Copy link

This pull request add a few things to the app, as discussed in #64

Here are the features and below a brief explanation on how they are implemented. We can discuss potential changes then.

Features

  • Chose from the 163 officials currencies in the world
  • Having the choice of different currencies when adding expenses
  • Added UI changes to allow displaying converted amounts from different currencies
  • Importing from 3.20- let you chose the currency of those previous expenses

How is it implemented ?

  1. All currencies are stored in a worldCurrencies.json file. I had wrote a simple go script to generate currencies.go file to keep the old hard-coded storage of currencies.
    However, the UI needs informations like formatting behavior (use commas ? where the symbol is placed ?) but the backend does not need it. The UI also fetch this worldCurrencies.json file to import the behaviors.

  2. Another form is added in the expense-form to select currencies. The currencies are loaded from backend (we just need CODE/SYMBOL representation) but the default one is the currency set in settings.

  3. Whenever a new expense is added, the backend launch a goroutine to fetch rates from a cdn. it is a simple http call and around 340 rates are returned for a base currency and a date. We only store rates present in our worldCurrencies.json file. There is around 160 rates. When the rate is present, the UI fetch it and update the UI within a correspondant case. It works like the tags class. If there is no other currencies in expense, that case is not shown.
    In index.html all amounts are converted to the currency set in settings. Under total we have a list of the other currencies total aswell with a choice of showing them in their currency or yours.
    There is NO UI BLOCKING when retrieving the rates, the initialize() function is called again 3s after adding expense to refresh data. If no rates has been fetched (no internet connection, timeout, etc) the backend will try on another refresh.

  4. After selecting your .csv file you'll be prompted with a modal asking for the currency to add with these expenses. Just use your previous currency set in settings and it will import them.

What could be done different ?

  • The worldCurrencies.json file is shared between frontend and backend. I think the best use case would be to let backend import it and offer an API to let frontend to fetch what it needs (simple code:symbol map or a full code:struct map).
  • Remove the hardcoded currencies generated code to only rely on the .json file at startup. User could then remove (or even add custom currencies if they fancy) some currencies if they really don't bother with them and it would also decrease the disk impact for the fx rates stored in db. (It is not that heavy on disk but it will be better)
  • Currently, frontend fetch rates and do the math (amout * rate) to update UI. It works but if we want backend to be the only source of truth we can add some API handlers to only return the convertedAmount. For example a map of id:convertedAmount. Current API rates handlers would still be present if needed.

Some screenshots

settings1

Settings page.

import

Import modal.

recurring

Existings Recurring expenses.

july_table june_table may_table

Different tables dependings of Tags and Currencies.

july_index1 july_index2

Pie chart and legend.

july_table2

And whenever I change my default currency, all amounts gets converted instantly because of fx rates storage.

Feel free to ask anything or any changes.

@Tanq16
Copy link
Owner

Tanq16 commented Jul 23, 2025

thanks @Sleapy31 ! allow me some days to take a look. appreciate the help.

@Tanq16
Copy link
Owner

Tanq16 commented Jul 27, 2025

hello @Sleapy31 , not forgotten about this PR. i've just been occupied in various things. i hope you don't mind some delays here. appreciate your patience, i will be testing your changes out this week.

i read your PR notes, and generally everything looks good. i'm yet to see the code and may have some comments about the conversion data prep.

thanks for all work on this - please allow me liberty for some delays.

@Sleapy31
Copy link
Author

Hi @Tanq16 ,
Don't worry I'm not in a hurry. Life comes first

@Tanq16
Copy link
Owner

Tanq16 commented Aug 21, 2025

just updating all comments/issues/prs - will get back to work on the project as soon as availability allows, appreciate the patience

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