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

Export transactions as CSV #197

Merged
merged 1 commit into from
Jan 14, 2024
Merged

Export transactions as CSV #197

merged 1 commit into from
Jan 14, 2024

Conversation

ymeiron
Copy link
Contributor

@ymeiron ymeiron commented Jan 10, 2024

This addresses #77, adding a button on the transactions page to download all transactions in the group as CSV. Apologies if that's the wrong place for the feature, I couldn't think of anything better.

The columns are: ID, Date, Payer, Name, Tags, Value; then follow n columns (one for each account in the group); the description comes last. The Tags column is either empty, contains just the tag if it's a single tag, or all tags separated by a comma and inside double quotes if there are multiple tags. CSV, being a "flat" format, cannot really contain the full information about a transaction, because it may contain an arbitrary number of positions. Therefore, only the calculated debit of each account appears.

For transfers, the value of the transaction appears as zero, the payer column shows the amount of the transfer, and the payee column shows the same amount in the negative. In both purchase and transfer, the value column is supposed to equal the some of all account debits.

Finally, the sorting is hardcoded, since I thought it's desirable for the CSV to be independent of what is currently displayed on the transaction page.

@mikonse mikonse merged commit ffded9c into SFTtech:master Jan 14, 2024
7 of 10 checks passed
@mikonse
Copy link
Contributor

mikonse commented Jan 14, 2024

Hi, thanks a lot for the PR.

I've merged it in #198 but made a couple changes to your implementation to keep it in line with the general code structure of the project. One larger change I've made is that there is no real distinction between transfers and purchases as the balance computation works the same for both, therefore the csv export should not differentiate between them.

Also there is no need to reeimplement the actual transaction balance computation as there already are utilities / core logic which do this, we just need to reuse it. See the type TransactionBalanceEffect and the redux selector selectTransactionBalanceEffects if you're interested.

@ymeiron
Copy link
Contributor Author

ymeiron commented Jan 15, 2024

Great! Thanks for the hard work, looking forward to 1.0.

I figured the transaction balance computation could be used from somewhere else in the codebase, but haven't figured out where it was exactly.

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