Skip to content

fix: (PRIORITY HIGH) Yagna: Total Active Teams Metric Includes Teams Without Logged Volunteer Hours#2094

Open
roshini1212 wants to merge 1 commit intodevelopmentfrom
roshini_fix_active_teams_metric
Open

fix: (PRIORITY HIGH) Yagna: Total Active Teams Metric Includes Teams Without Logged Volunteer Hours#2094
roshini1212 wants to merge 1 commit intodevelopmentfrom
roshini_fix_active_teams_metric

Conversation

@roshini1212
Copy link

@roshini1212 roshini1212 commented Mar 9, 2026

Description

The Total Active Teams metric was counting all teams marked as isActive: true regardless of whether any team member had logged actual volunteer hours within the selected reporting period. This led to inflated and misleading counts — a future date range with no activity still showed 1004 active teams instead of 0.
The fix updates getTotalActiveTeamCount in overviewReportHelper.js to join with the timeEntries collection and only count teams where at least one member has logged hours within the selected reporting period.
Fixes # (bug list priority HIGH)

Related PRS (if any):

None — backend only fix, no frontend PR required.

Main changes explained:

  • Update src/helpers/overviewReportHelper.js to rewrite getTotalActiveTeamCount to accept startDate and endDate, join with timeEntries, and filter teams by actual logged hours in the reporting period. Also made createdDatetime filter optional to avoid excluding teams without that field.
  • Update src/controllers/reportsController.js to pass isoStartDate, isoEndDate, isoComparisonStartDate, and isoComparisonEndDate into getTotalActiveTeamCount instead of only isoEndDate and isoComparisonEndDate.

How to test:

  1. Check out roshini_fix_active_teams_metric branch
  2. Run npm install then npm start to run the backend locally
  3. Clear site data/cache
  4. Log in as Owner
  5. Go to Dashboard → Volunteer Activities → observe Total Active Teams
  6. Set date range to a future period (e.g. Apr 8 – Jun 18, 2026) → verify Total Active Teams shows 0
  7. Set date range to current week → verify count reflects only teams with actual logged hours
  8. Set a broad historical range (e.g. Nov 2024 – Apr 2026) → verify a realistic count

Screenshots or videos of changes:

Before:
Screenshot 2026-03-08 at 22 37 05

Screenshot 2026-03-09 at 13 25 19

After:
Screenshot 2026-03-09 at 11 56 04

Screenshot 2026-03-09 at 12 37 58 Screenshot 2026-03-09 at 12 38 27

Note:

Include the information the reviewers need to know.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

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.

1 participant