Skip to content

Shubham Jakhete - Create way to see deactivated people's last week on the Weekly Summaries Reports page (frontend) - #5577

Merged
one-community merged 3 commits into
developmentfrom
shubham-deactivated-final-week
Oct 12, 2026
Merged

one-community merged 3 commits into
developmentfrom
shubham-deactivated-final-week

Conversation

@shubhamjakhete

Copy link
Copy Markdown
Contributor

Description

Bug list: "Create way to see deactivated people's last week on the Weekly Summaries Reports page" (priority high, Jae).

Deactivated people should still show up on the Weekly Summaries Report tab for the week they left, with a clear notice: "FINAL WEEK REPORTING: This team member is no longer active". Currently they show on no tab, and active people with a scheduled end date are hidden too.

The page decided who to show in two places, and both treated anyone with an endDate as leaving. FormattedReport also recalculated the final week itself, so it could disagree with the backend.

Related PRS (if any):

This frontend PR is related to backend PR OneCommunityGlobal/HGNRest#2363.
To test this frontend PR you need to check out backend PR OneCommunityGlobal/HGNRest#2363.
Link: OneCommunityGlobal/HGNRest#2363

Main changes explained:

  • Create src/utils/weeklySummariesFinalWeek.js with one shared rule: active users always show; inactive users show only on the tab matching the backend's finalWeekIndex.
  • Update WeeklySummariesReport.jsx to use the shared rule and remove its old filter functions.
  • Update FormattedReport.jsx to use the shared rule, remove its duplicate week calculation, and remove a commented-out copy of the notice.
  • Style the notice with the existing .finalWeekNotice / .finalWeekNoticeDark module classes instead of inline styles. Add a red left border, and make the dark-mode version readable (about 5:1 contrast). No new or generic class names.
  • Add unit tests for the rule and component tests for the notice. All 41 Weekly Summaries tests pass; 2 of the new component tests fail on the old code.

How to test:

  1. Check out this branch and backend PR Shubham Jakhete - Create way to see deactivated people's last week on the Weekly Summaries Reports page (backend) HGNRest#2363.
  2. Run npm install, then npm run start:local.
  3. Clear site data/cache and log in as an Admin or Owner.
  4. Deactivate a test user with a final day in last week, and schedule a separation for another test user in a future week.
  5. Go to Dashboard → Reports → Weekly Summaries Reports and click Refresh on each tab.
  6. Verify:
    • The deactivated user shows only on Last Week, with the notice and the correct final week dates.
    • The scheduled user shows on every tab, with no notice.
    • Total Team Members includes the scheduled user.
  7. Verify the notice in [dark mode](https://docs.google.com/document/d/11OXJfBBedK6vV-XvqWR8A9lOH0BsfnaHx01h1NZZXfI).

Screenshots or videos of changes:

SJ_Screenshot1 SJ_Screenshot2 SJ_Screenshot3 SJ_Screenshot4 SJ_Screenshot5

Note:

  • Tested as Owner (local seed data) and Admin (dev data). On dev, the Last Week tab now shows all 2,666 active users; before the fix, active users with a scheduled end date were missing.

Deactivated users should appear on the Weekly Summaries Report tab
for the week they left, with a final week notice. Right now they
appear on no tab, and active users with a scheduled end date are
hidden too.

- Move the visibility rule into weeklySummariesFinalWeek.js so both
  components use it
- Always show active users, even if they have an end date
- Show inactive users only on the tab matching the finalWeekIndex
  from the backend
- Style the notice with the existing module classes instead of
  inline styles

Adds unit and component tests for these cases.

Needs the HGNRest branch shubham-deactivated-final-week, which
returns the corrected finalWeekIndex.
The final week notice was hard to see in dark mode: near-white text
on a background barely different from the card.

- Add a red left border in both themes
- Use a visible red tint and light-red text in dark mode, with
  about 5:1 contrast
@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit daeec3d
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6acc1c9d6af9a7000843f873
😎 Deploy Preview https://deploy-preview-5577--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Reviewed 7276aa4 with the explicitly paired backend #2363 at f19b6618. The shared visibility rule now keeps active users with scheduled end dates on every tab, and shows inactive users only on their backend-provided final-week tab. The same rule is used for filtering, team counts and report rendering. I found no blocking issue in this pair.

Validation: 41/41 frontend tests passed in seven files on Node 20.19.4. The production build passed with 9,156 modules; changed-JS ESLint and git diff --check passed. The SCSS compiles in the build, but separate SCSS lint was not run because the configured parser is unavailable. Paired backend: 20/20 tests in two suites, Babel build 774 files, ESLint zero errors/nine warnings and diff check passed.

I also ran 20 isolated assertions across the real backend report helper and frontend visibility rules for all four tabs: zero-hour deactivated users, legacy missing inactiveReason, active scheduled separations, paused users and old inactive users. Aggregate persistence is mocked and its query predicates are interpreted by the fixture, not executed by MongoDB. Eight actual FormattedReport browser cases covered four tabs in both themes, with 24 visibility and four notice assertions; only the correct inactive tab shows the notice and dates. Five additional theme/contrast assertions used the real ThemeManager, app CSS and report route CSS. The dark notice measures 5.12:1 against its actual tinted background, meeting the description's claim and the normal-text contrast threshold. The existing CSS-module class names remain scoped.

final-week-evidence

No real accounts were deactivated or scheduled for separation; there were no database writes or external API calls. Full authenticated Admin/Owner navigation and a real MongoDB aggregation remain unverified.

Commit audit: both commits are focused, imperative, under 72 characters, without trailing periods, and include blank-separated what/why bodies. The dependency branch is named; adding #2363 or a relevant ticket in the commit body would improve traceability. Approved.

@vidiyala99 vidiyala99 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 7276aa4 with backend #2363 (f19b661) as Administrator and Volunteer, in light and dark mode, against the shared dev data. Both PRs only change how the report is read, so nothing was written; I used users who are already inactive on dev instead of deactivating anyone.

Before (backend development), calling GET /api/reports/weeklysummaries?week=N for each tab: every tab returned all 56 inactive users, and the one person who left last week ("DevAdmin100 Mahika DontEdit TOS Bravo") came back with finalWeekIndex: 0 on the Last Week request, so no tab matched.

After (this PR + #2363):

  • API: only active users plus people who left in the requested week are returned. Mahika gets finalWeekIndex: 1, Ashmita Pal (left 09-26) gets 2, two users whose final day is this week get 0, and active users with a scheduled end date get null.
  • UI, checked by exact name on each tab: Mahika appears only on Last Week, Ashmita Pal only on Week Before Last, the two this-week users only on This Week, and Three Weeks Ago has no final-week notice. Active users with an end date (Summit Kaushal, Rajeshwari Mangers2) appear on all four tabs with no notice. Total Team Members goes 2699 / 2698 / 2698 / 2697 accordingly.
  • Notice: "FINAL WEEK REPORTING: This team member is no longer active" shows the right dates (Last Week: Sep 27 - Oct 3, 2026) and is readable in both themes (screenshots 1 and 2). It uses the module classes, with no new generic class names.
  • Volunteer: /weeklysummariesreport redirects to the dashboard, as before.
  • Tests: frontend Weekly Summaries tests 41/41 and backend finalWeekIndex + reporthelper tests 20/20 pass.

Three small notes, not blocking:

  1. These two need to merge together. With this frontend and the old backend, the frontend trusts a finalWeekIndex that the old backend computes relative to the requested tab, so departed users would land on the wrong tab.
  2. #5597 (active team code suggestions, also high priority) calls weekIndexFromEndDate in FormattedReport.jsx, which this PR removes, so whichever merges second will need shouldShowSummaryOnTab there.
  3. reporthelper.weeklySummaries is also used by the weekly summaries email job (userHelper.emailWeeklySummariesForAllUsers). After #2363, that email will include only people who left during that week instead of every inactive user. That looks like an improvement, but it's worth a line in the backend description.

Approving.

1. Last Week tab, light mode: final-week notice on the user who left last week

Image

2. Same view in dark mode

Image

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

Reviewed by Aadit Trivedi.

Frontend pair of HGNRest #2363, which I reviewed and approved. I reviewed the diff and ran the tests (weeklySummariesFinalWeek.test.js and the WeeklySummariesReport suite: [41/41] passing); I didn't test it end to end, since #2363 isn't merged.

Verified

  • The final-week decision previously lived in two places with different logic: FormattedReport.jsx recomputed the tab from endDate in the browser (weekIndexFromEndDate), while WeeklySummariesReport.jsx compared against finalWeekIndex (shouldIncludeSummaryForWeek). Both now use the shared shouldShowSummaryOnTab and isFinalWeekOnTab from weeklySummariesFinalWeek.js, which has its own tests.
  • The old if (summary.endDate && !isFinalWeek) return null hid any user with an endDate outside their final week, including active users with a future scheduled separation. Basing the check on the backend's finalWeekIndex, which #2363 sets only for users who have left, removes that problem.
  • The commented-out final-week message is removed, and its inline colors moved to SCSS classes with a dark mode variant.

Pointer, not blocking

  • The last commit is from Sep 23, 2026; please update the branch with development before merge, and merge it together with #2363, since it depends on finalWeekIndex from that PR.

Approving.

@sonarqubecloud

Copy link
Copy Markdown

@one-community

Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community
one-community merged commit 0f3b23d into development Oct 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants