[BUG]: respect granularity when limiting analytics time-series buckets
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- analytics
Research direction
Read src/services/analytics.js and the existing tests in src/services/analytics.buildTimeSeries.test.js. Check how buildTimeSeries handles weekly and monthly buckets and how the tests verify bucket counts and ordering. Done when monthly results are capped at 12, weekly results at 26, and the results remain chronologically sorted.
Written by the indexing model from the issue text.
Description
Bug Description
The buildTimeSeries function in src/services/analytics.js limits its output to the last 12 buckets regardless of the selected granularity.
As a result, the Weekly view displays only approximately 12 weeks of activity (~3 months), while the Monthly view can display up to 12 months of activity. This creates inconsistent historical windows when switching between granularities.
The function already accepts a granularity parameter, but the final .slice(-12) applies the same limit to both monthly and weekly buckets.
Expected Behavior:
- Monthly granularity should retain up to 12 buckets (~12 months).
- Weekly granularity should retain up to 26 buckets (~6 months).
Actual Behavior:
Both granularities are limited to 12 buckets, causing older activity to disappear from the Weekly view.
Proposed Fix
Use a bucket limit based on the selected granularity instead of hardcoding the limit to 12:
const SLICE_COUNT = granularity === 'weekly' ? 26 : 12;
return Object.values(buckets)
.sort((a, b) => a.date.localeCompare(b.date))
.slice(-SLICE_COUNT);
This allows the Weekly view to retain up to 26 buckets while preserving the existing 12-bucket limit for the Monthly view.
Testing
Update src/services/analytics.buildTimeSeries.test.js to verify that:
- Monthly granularity returns at most 12 buckets.
- Weekly granularity returns at most 26 buckets.
- Weekly granularity can return more than 12 buckets when sufficient data is available.
- Results remain sorted chronologically.
Scope
- Implementation:
src/services/analytics.js - Tests:
src/services/analytics.buildTimeSeries.test.js - No UI, layout, or API changes are required.
Steps to Reproduce
- Run the application locally using
npm run dev. - Explore an organisation with sufficient issue or pull request history, such as
AOSSIE-Org. - Navigate to the Analytics page.
- Click Run Complete Analysis to populate the time-series chart.
- Select Monthly granularity and observe the displayed date range.
- Switch to Weekly granularity.
- Observe that the chart displays at most 12 weekly buckets, even when older activity is available.
The issue can also be reproduced by passing more than 12 distinct weekly buckets to buildTimeSeries in src/services/analytics.js.
Logs and Screenshots
No error logs are expected because this is a data truncation issue rather than a runtime error.
A screenshot comparing the Monthly and Weekly analytics views would help demonstrate the inconsistent historical windows.
Relevant implementation: src/services/analytics.js, where the returned buckets are limited using .slice(-12).
Relevant tests: src/services/analytics.buildTimeSeries.test.js.
Environment Details
- OS: Ubuntu 26 LTS
- Browser: Brave (Chromium-based)
- Runtime: Node.js 22.22.1
- Project: AOSSIE-Org/OrgExplorer
- Setup: Local development environment using
npm run dev - Additional context: The issue concerns the time-series bucket limit in
src/services/analytics.js.
Impact
Medium - Feature works but has issues
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Dominant language
- JavaScript
- Stars
- 42
- Forks
- 124
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/OrgExplorer
-
[BUG]: Loading skeletons use hardcoded dark colors and appear as dark blocks in light mode on every pagePossibly taken @g-k-s-03 claimed this 4 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/OrgExplorer#326 · 1 comment ·
Maintainers usually reply within 1 day
-
[FEATURE]: Pressing Enter after typing all orgs to search should hit explore.Possibly taken @Rajvardhan-Singh-Rathore claimed this 4 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
AOSSIE-Org/OrgExplorer#324 · 7 comments ·
Maintainers usually reply within 1 day
-
[BUG]: Navigating to a new page preserves the previous scroll positionPossibly taken @syedbarkath980 claimed this 7 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AOSSIE-Org/OrgExplorer#314 ·
Maintainers usually reply within 1 day
-
[FEATURE]: Add Language column in Repository Explorer tableMay be free again @ProgrammerNesi claimed this 7 days ago, and no pull request is open. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AOSSIE-Org/OrgExplorer#309 · 4 comments ·
Maintainers usually reply within 1 day
-
chore(assets): Convert org-explorer-logo.png to SVGMay be free again A pull request for this issue was closed without being merged. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AOSSIE-Org/OrgExplorer#301 · 2 comments ·
Maintainers usually reply within 1 day
All issues in AOSSIE-Org/OrgExplorer
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
[quality] Nothing keeps docs/skills/manifest.md in sync with docs/skills/*.mdPossibly taken @hivecommons-hive claimed this today. Openagent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
needs verification
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
apache/rocketmq-dashboard#6610 ·
Maintainers usually reply within 3 days