Skip to content

Gayatri - Fix Total Active Teams card not matching Team Stats - #2391

Open
sawantgayatri19 wants to merge 1 commit into
developmentfrom
gayatri/fix-active-teams-mismatch
Open

sawantgayatri19 wants to merge 1 commit into
developmentfrom
gayatri/fix-active-teams-mismatch

Conversation

@sawantgayatri19

Copy link
Copy Markdown

Description

Screenshot 2026-10-08 at 4 27 59 PM

On Total Org Summary (Current Week), the "Total Active Teams" card showed 4 while Team Stats showed "211 teams with 2+ active members". They used different definitions of "active team": the card counted teams where any member logged time in the period, while Team Stats counts active teams with N+ currently active members.

Fixes # (bug list priority urgent: P1 Total Org Summary "Total Active Teams" card doesn't match Team Stats)

Related PRS (if any):

Frontend label: OneCommunityGlobal/HighestGoodNetworkApp#5634
To test, run this backend branch with that frontend PR.

Main changes explained:

  • src/helpers/overviewReportHelper.js: getTotalActiveTeamCount now uses the same definition as Team Stats: an active team (created by the end date) with at least 2 currently active members, by reusing getTeamsWithActiveMembers. The card now equals Team Stats' default "N teams with 2+ active members". Comparison periods use the same definition.
  • Removed debug console.log statements and an unused Team.countDocuments query from that function.
  • src/helpers/overviewReportHelper.spec.js: added tests for the shared definition, the comparison values, and the zero case.

How to test:

  1. Check out this branch and run the backend; run frontend PR #5634
  2. Log in as admin → Total Org Summary → Current Week
  3. Compare the Active Teams (2+ Members) card with Team Stats → "N teams with 2+ active members"
  4. Both numbers should be equal (e.g. 212 = 212)

Screenshots or videos of changes:

Screenshot 2026-10-08 at 3 06 42 AM

Note:

Definition chosen: "active team = active team with 2+ active members", matching Team Stats' default. The card no longer means "teams that logged hours this week". If a different minimum (e.g. 1) is preferred, it's a one-line change (ACTIVE_TEAM_MIN_MEMBERS).

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@mahikakakkad mahikakakkad 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.

Tested locally with this branch and frontend #5634 on shared dev data, Current Week and Previous Week, light mode.

✅ The Active Teams card now shows 213, matching Team Stats’ “213 teams with 2+ active members” (previously 4 vs 211).
✅ The value stays consistent across Current Week and Previous Week.

Looks good, approving. Note for merging: #2389 also changes overviewReportHelper.js, so whichever merges second may need a quick rebase.

This branch has not been deployed

No deployments
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