Skip to content

Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 60+ ranges#2266

Open
Abhi-R0211 wants to merge 2 commits into
developmentfrom
Abhishek_FixHoursBucketBoundaries
Open

Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 60+ ranges#2266
Abhi-R0211 wants to merge 2 commits into
developmentfrom
Abhishek_FixHoursBucketBoundaries

Conversation

@Abhi-R0211

@Abhi-R0211 Abhi-R0211 commented Jul 8, 2026

Copy link
Copy Markdown

Bug

The Volunteer Hours Distribution chart's bucket boundaries were incorrect - volunteers logging 50-59 hours in a week had no dedicated bucket, and there was no proper overflow bucket beyond that, causing misleading/confusing values on the frontend donut chart.

Root Cause

The bucket-building loop in getVolunteerHoursStats() (overviewReportHelper.js) only generated buckets 0-9 through 50-59 correctly, but the top-end overflow handling was missing/incorrect, so volunteers above the highest defined range weren't being captured in a meaningful bucket.

Fix

Corrected the bucket generation so volunteerHoursStats now includes all of: 0-9, 10-19, 20-29, 30-39, 40-49, 50-59, and a 60+ overflow bucket for anyone logging 60 or more hours in the week.

API Endpoint to Test

Route: GET /api/reports/overviewsummaries/volunteerhoursstats

Required query params (all four):

  • startDate (e.g. 2024-01-14)
  • endDate (e.g. 2024-01-21)
  • lastWeekStartDate (e.g. 2024-01-07)
  • lastWeekEndDate (e.g. 2024-01-14)

Note: all four are required. Omitting any of them returns a 400 with "Start date and end date are required".

Sample request:

GET http://localhost:4500/api/reports/overviewsummaries/volunteerhoursstats?startDate=2024-01-14&endDate=2024-01-21&lastWeekStartDate=2024-01-07&lastWeekEndDate=2024-01-14

Auth: requires a valid Authorization bearer token (Admin role tested). Grab one from any authenticated request's headers in the browser Network tab while logged into the frontend locally.

Verified sample response (after this fix):

{
  "volunteerHoursStats": {
    "numberOfUsers": 12,
    "0-9": 9,
    "10-19": 1,
    "20-29": 0,
    "30-39": 1,
    "40-49": 0,
    "50-59": 0,
    "60+": 1
  },
  "percentageWorkedStats": {
    "thisWeek": { "<100": 9, "100-109": 0, "110-149": 2, "150-199": 0, "200+": 1 },
    "lastWeek": { "<100": 5, "100-109": 0, "110-149": 1, "150-199": 0, "200+": 0 }
  }
}

Testing

  • Verified locally via direct curl request against this branch (Abhishek_FixHoursBucketBoundaries), confirming volunteerHoursStatsincludes a proper50-59bucket and a60+` overflow bucket - Verified locally with the frontend running against this branch

Related PR

Frontend companion PR (tooltip label fix, depends on this branch for full verification): OneCommunityGlobal/HighestGoodNetworkApp#5374 on
branch Abhishek_FixHoursDistributionTooltipLabel

To test both fixes together, check out this backend branch (Abhishek_FixHoursBucketBoundaries) alongside that frontend branch.

@Abhi-R0211 Abhi-R0211 self-assigned this Jul 8, 2026
@Abhi-R0211 Abhi-R0211 changed the title Abhishek_Fix: Volunteer Hours Distribution tooltip mislabels volunteer count as "Hours" Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 50+ ranges Jul 8, 2026

@DeepighaJ DeepighaJ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide the api endpoints to test this feature. Also please check the frontend comments as well.

@HemanthNidamanuru HemanthNidamanuru left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Abhishek,

I tested this backend PR locally.

The fix looks clear, but the specific API endpoint to test this change is not mentioned in the PR description. Could you please add the API route or sample request so reviewers can verify it properly?

Also, while testing with the related frontend branch, the Volunteer Hours Distribution graph itself is not loading, so I’m unable to fully verify the frontend behavior together with this backend change.

@Abhi-R0211 Abhi-R0211 changed the title Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 50+ ranges Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 60+ ranges Jul 13, 2026
@Abhi-R0211

Copy link
Copy Markdown
Author

Hi @DeepighaJ @HemanthNidamanuru - thanks for the feedback.

I've added the API endpoint details to the PR description above, including required query params, a sample request, and the expected response shape.

Regarding the "chart not loading / Total Hours Worked: 0" issue you both hit while testing against the frontend branch - that appears to be a separate issue on the frontend side (companion PR #5374), not something in this backend fix. I'm investigating that separately and will update once it's resolved so you can verify the full end-to-end behavior together with this branch.

In the meantime, this PR's backend change can be verified directly via the endpoint above independent of that frontend issue. Let me know if the updated description and endpoint info address your first ask.

@Abhi-R0211 Abhi-R0211 force-pushed the Abhishek_FixHoursBucketBoundaries branch from b6e0baa to c7b9df4 Compare July 13, 2026 23:08
@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants