Skip to content

[WIP] Fix average calculation based on days with entries#312

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/fix-average-calculation-issue
Closed

[WIP] Fix average calculation based on days with entries#312
Copilot wants to merge 1 commit intomasterfrom
copilot/fix-average-calculation-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 6, 2026

Plan to fix average calculations

  • Explore repository structure and understand the issue
  • Identify the problem: averages are calculated based on days with entries, not calendar days
  • Update computeAverage function in statistics-utils.dart to:
    • For past periods: count all calendar days from start date to today (or end date if earlier)
    • For future periods: only count days that have entries
  • Update average calculation in overview-card.dart to use the same logic
  • Create tests for the new average calculation logic
  • Run tests to validate changes
  • Verify the fix works as expected
Original prompt

This section details on the original issue you should resolve

<issue_title>Average calculation</issue_title>
<issue_description>Hi,

the averages are calculated based on the number of days with entries, not calendar days in the month/year.
I guess this is not on purpose, as it is not very helpful!? 🙂

Great app btw
Thanks
DrDee</issue_description>

Comments on the Issue (you are @copilot in this section)

@emavgl I don't see it very helpful neither if it would count the day with 0 expenses, as missing entries are not the same of spending 0 money. But I get your point here. Do you find the opposite helpful? @emavgl I don't have a hard opinion, so if you find it useful, I'll adapt it the way you said:
  • Count the day with no expenses in the past, but not in the future</comment_new>
    <comment_new>@emavgl
    Well those should count I believe. As the user has inserted the value in the future, he would probably be interested in seeing that</comment_new>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

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.

Average calculation

2 participants