Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 60+ ranges#2266
Abhishek_Fix: Volunteer Hours Distribution bucket boundaries missing 50-59 and 60+ ranges#2266Abhi-R0211 wants to merge 2 commits into
Conversation
DeepighaJ
left a comment
There was a problem hiding this comment.
Please provide the api endpoints to test this feature. Also please check the frontend comments as well.
HemanthNidamanuru
left a comment
There was a problem hiding this comment.
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.
|
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. |
b6e0baa to
c7b9df4
Compare
|



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 buckets0-9through50-59correctly, 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
volunteerHoursStatsnow includes all of:0-9,10-19,20-29,30-39,40-49,50-59, and a60+overflow bucket for anyone logging 60 or more hours in the week.API Endpoint to Test
Route:
GET /api/reports/overviewsummaries/volunteerhoursstatsRequired 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
400with"Start date and end date are required".Sample request:
Auth: requires a valid
Authorizationbearer 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
curlrequest against this branch (Abhishek_FixHoursBucketBoundaries), confirming volunteerHoursStatsincludes a proper50-59bucket and a60+` overflow bucket - Verified locally with the frontend running against this branchRelated PR
Frontend companion PR (tooltip label fix, depends on this branch for full verification): OneCommunityGlobal/HighestGoodNetworkApp#5374 on
branch
Abhishek_FixHoursDistributionTooltipLabelTo test both fixes together, check out this backend branch (
Abhishek_FixHoursBucketBoundaries) alongside that frontend branch.