-
Notifications
You must be signed in to change notification settings - Fork 19
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
Error when importing Fuelly formatted CSV #42
Comments
After some further debugging, I've identified the problem as user.Currency containing the fully expanded currency format "US dollars (USD" when accounting.UnformatNumber expects the format to be "USD". I'm tempted to simply use a regex to extract the substring between the parentheses, but that feels inelegant Regex form here var rgx = regexp.MustCompile(`\((.*?)\)`)
totalCostStr := accounting.UnformatNumber(record[9], 3, rgx.FindStringSubmatch(user.Currency)[1]) Feels messy but it works (for USD, the one case I tested), and only runs when importing so very rarely. |
The currency model actually contains a prop for the currency code. I'm going to see if I can get the code from the model using the currency value set for the user. However, once you get past the locale error it seems the csv format may have changed. @ZHoob2004 would you mind providing the first line on your csv export (headings)? I only have records in fuelly as recent as Oct 2021. hammond/server/models/currency.go Lines 12 to 21 in f079227
|
@ZHoob2004 does your csv contain expenses along with fillups, or just fillups? |
I tried both with and without an expense line but wasn't getting past the locale issue. I had the same locale problem when importing any of the examples from the akhilrex/hammond repo and those contain expenses |
Good to know, once the #49 pull request is merged you should at least be able to import fillups. |
@ZHoob2004 you should now be able to import using the generic import. |
Thank you very much. I already managed to import mine with my hack a while ago but hopefully this will help others with non-fuelly data sets to import (since I had to reformat mine by hand) |
Hi, just built a new docker from latest image but generic import option is not an option, only Drivvo. Anyone able to share an Drivvo-exported CSV for reference since it is a paid option to export :( and it doesn´t like my Fuelly either. |
Sorry, didn't catch the conversations here before now. I forgot to make a release after merging @alienp4nda's code. I created a new release now. |
Once PR #88 is merged and a new docker image is built I believe this issue can be closed. If possible, could either @aspapunktse or @ZHoob2004 test out the new image once it's built? |
I no longer have the data I used to test with, and it wasn't "true" fuelly data anyway, since I exported it from another app and reformatted it. There are 2 sample data sets in this issue that can be used to verify. These did not work when I last tested. akhilrex#11 |
No worries, and thanks for the data reference. I'll grab those and test those. |
There still seems to be issues with with the generic imports when there is only a value when the tank is filled up but no value when the tank wasn't filled up. The generic import also doesn't take into account fillups and services mixed in the same file. Adding the csv files from the issue by @ZHoob2004 to this issue. |
I am running the latest docker build and experiencing the same issue. Adding my Fuelly Export so you have a current file to work with: FuellyExport.csv
|
The "No Locale Info Found" error suggests that you're running an older build. Please verify you're running v0.0.24. |
I tried running both alfhou/hammond:latest(docker hub) and ghcr.io/alfhou/hammond:latest(github) images. They both are showing the same Digest (sha256:c85dc0293aa10be15280277bade9cce808be572d0d4c5eac62acd87dec30479d). Both images show "2022.07.06" in the More Info section of the Settings page. Should that be showing "v0.0.24" instead?
|
Verified this is an issue, this will take me a bit to troubleshoot. |
There are two related issues causing this. The currency is saved as "Currency Name (CODE)". The settings page does this as does the initialize page on a brand new instance. The backend is expecting only the currency code. I have a fix but this will require everyone who has an existing instance to go to the settings page and select their currency again then save the settings. |
It's up to you which way to go, but it looks like the issue is only affecting me at the moment. If you could share a workaround, I could import my data and not inconvenience everybody else.
|
It will not just affect you, currently any backend code that needs to use the currency and is expecting the currency code will be affected. I'll just need to figure out a way to notify users. |
I'm unable to import a "Fuelly" CSV and get the following error
This happens with either of the example exports from the akhilrex repo as well as my hand-formatted example from another app.
Using latest docker image
The text was updated successfully, but these errors were encountered: