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

Fix average monthly income calculation #125

Merged
merged 2 commits into from
Sep 29, 2024

Conversation

jeromecornet
Copy link
Contributor

The number of months for monthly average income calculation only takes into account the months where there is an actual income. So if there is a month with no income (for example last year), the 'monthly average' gets artificially bumped up.

This simplifies the calculation to use the actual number of months in the given year (current month number for the current year, 12 for previous years) rather than only the months where there was some income

@jeromecornet jeromecornet changed the title Fix averge monthly income calculation Fix average monthly income calculation Sep 28, 2024
@jeromecornet jeromecornet marked this pull request as draft September 28, 2024 14:42
@jeromecornet
Copy link
Contributor Author

jeromecornet commented Sep 28, 2024

To fix the overall calculation as well as to take into account history starting less than 2 years ago, I ended up adding a query to figure out the date of the oldest transactions so that the correct number of months is taken into account (i.e. less than 12 for previous year/2 years ago if the history doesn't go that far)

@jeromecornet jeromecornet force-pushed the fix_monthly_calculation branch 2 times, most recently from 7e5106c to 37355ba Compare September 28, 2024 15:59
@jeromecornet jeromecornet marked this pull request as ready for review September 28, 2024 16:02
@afadil afadil merged commit 121f74e into afadil:main Sep 29, 2024
@afadil
Copy link
Owner

afadil commented Sep 29, 2024

Merci @jeromecornet

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