spiral-project / ihatemoney

A simple shared budget manager web application
https://ihatemoney.org
Other
1.18k stars 267 forks source link

Unable to add any new bills due to lack of default currency (6.1.0) #1229

Closed lbeltrame closed 1 year ago

lbeltrame commented 1 year ago

As the subject says, it is impossible to add new bills because the form prevents submitting, because the currency field is empty. This doesn't work via API as well because the API returns that currency is a required field.

There was an issue opened a couple of years ago, but it was closed (and it doesn't tell whether the issue was fixed or not).

Setup:

Checked database migrations and everything should be fine.

I couldn't extract meaningful information via logs, but I haven't raised the debug level yet.

lbeltrame commented 1 year ago

EDIT: The reason is that originally a currency was set, many years ago. It remained set, but since the service used by this project is no longer available, I guess that broke things.

Setting manually to "No currency" allowed creation of new bills again. However I'm not going to close this, as this is still a bug.

zorun commented 1 year ago

You mean that the project was created with a currency that no longer exists?

Can you look in the database to see what is the exact value of the currency for your project?

zorun commented 1 year ago

That would be: SELECT id, name, default_currency FROM project;

The code around currencies is fragile, I would not be surprised if there are loopholes. Let's figure out the issue and add a testcase.

almet commented 1 year ago

Interesting, thanks.

the service used by this project is no longer available

I was not even aware of this, and it's clearly something we should fix. Relying on external services is indeed a bad idea in the first place. We might want to completely change the way we're dealing with external currencies. I know that for instance in cospend they let you specify the conversion rate.

UndeRus commented 1 year ago

I have same problem, now project is unusable, I can't add any transactions

Now ihatemoney calls this API https://api.exchangerate.host/latest?base=USD which need api key to use, we need to predefine currencies to make it work without external api calls

Arvil commented 1 year ago

I have encountered the same issue on ihatemoney.org, can confirm @lbeltrame's quick fix works there too

zorun commented 1 year ago

As a quick fix, we can probably hard-code the list of currencies. This should allow adding bills in the same currency as the project currency. It seems to be the use-case of @lbeltrame and @Arvil here, since we prevent converting a project to "no currency" as soon as there are bills in different currencies.

The longer-term fate of the currency feature is discussed here: #1232

shahram7 commented 1 year ago

I have the same problem. I am not able to post a new note in the money buster app and in the server. I am not able to select a currency in ihatemoney server because there is none available. I am using mariadb and the latest docker image. (I've redeployed)

zorun commented 1 year ago

Workaround added in #1240, and released as 6.1.1