[72676] 'Actual costs per months' widget does not show previous 11 months#22149
Open
HDinger wants to merge 1 commit intorelease/17.2from
Open
Conversation
35c8ee5 to
c420236
Compare
myabc
requested changes
Mar 2, 2026
| super | ||
|
|
||
| @aggregated_costs = Costs::AggregatedCosts.new(project:, current_user:, date_range: Date.current.all_year) | ||
| @aggregated_costs = Costs::AggregatedCosts.new(project:, current_user:, date_range: 11.months.ago.to_date..Date.current) |
Contributor
There was a problem hiding this comment.
The first (and likely last) month bars in the chart will show an incomplete month's data (unless Date.current happens to be on the 1st of the month)
Do we want to show rolling 12 months, as you've implemented? - or the last 12 full calendar months?
Suggested change
| @aggregated_costs = Costs::AggregatedCosts.new(project:, current_user:, date_range: 11.months.ago.to_date..Date.current) | |
| start_date = Date.current.beginning_of_month - 11.months | |
| end_date = Date.current.end_of_month | |
| @aggregated_costs = Costs::AggregatedCosts.new(project:, current_user:, date_range: start_date..end_date) |
start_date..end_date
# => Tue, 01 Apr 2025..Tue, 31 Mar 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/72676
What are you trying to accomplish?
Show last 11month and current month instead of the current year