Add start and end date to weekly project statistics - #1606
Conversation
Greptile SummaryThe PR adds optional start and end dates to weekly project aggregation and changes weekly bucket generation.
Confidence Score: 4/5The PR is not yet safe to merge because the default weekly aggregation still returns inconsistent bucket counts between live and rollup-backed paths. The attempted default-window fix is bypassed when weekly_project_stats passes its internally derived effective_start as an explicit start_date, leaving live aggregation and rollup generation at thirteen buckets while rollup reads expose twelve. Files Needing Attention: app/services/dashboard_data/snapshots.rb Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[weekly_project_stats without dates] --> B[Derive effective_start]
B --> C[Pass effective_start as start_date]
C --> D[week_ranges custom branch]
D --> E[13 generated buckets]
E --> F[Live result and rollup refresh]
G[Rollup reader] --> H[week_ranges without dates]
H --> I[12 generated buckets]
Prompt To Fix All With AI### Issue 1
app/services/dashboard_data/snapshots.rb:89
**Default window still has thirteen buckets**
When `weekly_project_stats` is called without dates, it passes the derived `effective_start` as a supplied start date, causing `week_ranges` to select the custom-range branch and generate thirteen buckets. Live aggregation and rollup generation therefore cover thirteen weeks while rollup reads expose twelve, producing different weekly statistics depending on whether a valid rollup is available.
```suggestion
ranges = week_ranges(user.timezone, start_date: start_date, end_date: end_date)
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (3): Last reviewed commit: "Merge branch 'main' into weekly-project-..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance and include this reference: |
|
truly amazing |
Summary of the problem
Creating this for #1604
Closes #1605
Describe your changes
Allow callers to get weekly project stats for custom date ranges, not only 12 weeks before today.
weekly_project_statsandweek_rangesnow accept optionalstart_dateandend_dateparameters