Repository navigation
Gayatri - fix: count hours from volunteers deactivated later in period - #2389
Conversation
|
mahikakakkad
left a comment
There was a problem hiding this comment.
Tested locally with this backend branch and frontend development, using shared dev data for Sep 27 – Oct 3, 2026. In that week, a test volunteer logged 5 hrs and was then deactivated.
Compared against dev.highestgood.com (current development backend) for the same week:
Total Hours Worked: 118 → 123 (+5)
Volunteers who logged 1+ hours: 6 → 7 (+1)
The difference matches the deactivated volunteer’s 5 hours exactly, and the other cards are unchanged. Looks good, approving.
|
Thank you all, merging! |
rahulrubugunday
left a comment
There was a problem hiding this comment.
Tested locally on gayatri/fix-deactivated-hours-be at 06f7c69 with the frontend on development, as Administrator. Branch merges cleanly with development.
- Unit tests: 11/11 passing (overviewReportHelper.spec.js and reportsController tests).
- Logged 2 tangible hours this week on a test Volunteer, then paused the account. In the Total Org Summary volunteerstats response for Current Week, activeVolunteers dropped from 2586 to 2585, while totalHoursWorked.current stayed at 23, volunteerHoursStats stayed at "10": 1 / "20": 1, and completedHours stayed at 22. The paused volunteer's hours are still counted.
- Date inputs to workedDuringPeriodMatch are normalized to YYYY-MM-DD before the query, which prevents operator injection.
Approving



Description
Deactivating or pausing a volunteer removed all of their logged hours from Total Org Summary, even hours logged in the selected period before deactivation. Example: a test volunteer logged 5 hours this week and was then deactivated; Total Hours Worked dropped 96 → 91 and "Volunteers who logged 1+ hours" dropped 4 → 3, while the Hours Completed chart still included the 5 hours.
Per Jae, hours logged in the selected period by volunteers who were later deactivated should still count in every report.
Fixes # (bug list priority urgent: P1 Total Org Summary - deactivating a volunteer removes their hours from "Total Hours Worked")
Related PRS (if any):
None. Backend only.
Main changes explained:
src/helpers/overviewReportHelper.js: addedworkedDuringPeriodMatch(periodStart, periodEnd), which matches users who are active now OR have time entries in the selected period.getHoursStats(hours donut + "volunteers logged 1+ hours") andgetTotalHoursWorked(Total Hours Worked card) use it instead ofisActive: true.endDate/deactivatedAt. The existing time-entry date filters still limit hours to the selected period.overviewReportHelper.spec.js: mocksTimeEntries.distinctfor the existing date-boundary tests.How to test:
developmentvolunteerstats→ Preview, notetotalHoursWorked.currentand thevolunteerHoursStats"10" countScreenshots or videos of changes:
Tested locally with a test volunteer (0.13 hrs this week), then paused:


Note:
Backend tests for
overviewReportHelperandreportsControllerpass.