Skip to content

Priyanka - Add CSV export to weekly PR grading screen - #5613

Open
muthapriyanka wants to merge 10 commits into
developmentfrom
Priyanka_weekly_pr_grading_csv
Open

muthapriyanka wants to merge 10 commits into
developmentfrom
Priyanka_weekly_pr_grading_csv

Conversation

@muthapriyanka

@muthapriyanka muthapriyanka commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

The Weekly PR grading screen did not have an Export to CSV option. Coordinators had to copy reviewer data manually to use it outside the application. This PR adds a client-side CSV download of the reviewers currently visible on the screen.

The export includes reviewer name, PR reviewed count, PRs needed, PR numbers, and notes when available. Its filename includes the date range displayed on the page. Search and role filters also apply to the exported rows.

Implements the Weekly PR grading screen Export to CSV task:
export_csv_task

Related PRs (if any)

Main changes explained

  • Added an Export to CSV button on the Weekly PR grading screen.
  • Added csvExport.js to build and download the CSV, escape CSV values, protect spreadsheet-formula-like values, and create a date-range filename.
  • Updated the header styling to accommodate both buttons.
  • Added tests for CSV content and filename generation.
  • Added screen tests confirming that the button exports filtered reviewers and includes a newly added PR without requiring Done.
  • Added an Export to CSV button beside Review Week on the Team Alpha dashboard (/pr-grading-dashboard). It exports the rows currently shown.”

How to test

  1. Check out this PR branch and install dependencies with npm install if needed.
  2. Start the frontend with npm run start:local.
  3. Log in and open /pr-grading-test, then select a original to open the Weekly PR grading screen.
  4. Click Export to CSV. Open the downloaded file and verify its columns, reviewer rows, PR numbers, and date-range filename.
  5. Search for a reviewer and export again. Verify that only the matching visible rows are included.
  6. Apply a role filter and export again. Verify that only the visible rows for that role are included.
  7. Add a PR to a reviewer and export before clicking Done. Verify that the new PR appears in the CSV.
  8. Open /pr-grading-dashboard, click Export to CSV, and confirm the downloaded rows and grades match the dashboard.

Video of changes

Export_CSV.mp4
added_cvs_to_dashboard

@netlify

netlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 1770acd
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6adea729ecf476846077b025
😎 Deploy Preview https://deploy-preview-5613--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.

@manavkheni1 manavkheni1 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 using the built-in test harness (/pr-grading-test, "91NePRT" configuration, 8 reviewers). Verified the exported CSV matches the on-screen table exactly — reviewer names, PR reviewed counts, PRs needed, PR number formatting (including "+" grouped entries), and blank fields for reviewers with no PRs reviewed. Filename correctly includes the date range. Confirmed search filter and role filter each correctly limit the export to only the visible/matching rows, and a newly added PR is included in the export even before clicking "Done." No issues found.

Image Image Image Image Image Image Image

@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 at a8af74c locally (frontend on this branch, backend on development) as Admin in light and dark mode. The PR's tests pass (csvExport.test.js + PRGradingScreen.export.test.jsx: 2 files, 4 tests).

Working:

  1. Export works and matches the table. On /pr-grading-test with the "ComplexTeam" configuration, Export to CSV downloaded weekly-pr-grading-6-15-2025-to-6-22-2025.csv:
"Reviewer Name","PR Reviewed Count","PRs Needed","PR Numbers","Notes"
"David Williams-Johnson","3","20","1000 + 2000; 3000; 4000 + 5000",""
"Emma","0","0","",""
"Frank","1","50","9000",""
"Grace","4","5","10000 + 11000; 12000; 13000 + 14000; 15000",""

Grouped PRs keep their "+", the reviewer with no PRs gets empty fields, and the filename uses the date range shown on screen. /pr-grading-screen exports its 91NePRT rows the same way.
2. CSV safety: values are quoted, quotes are doubled, cells starting with =, +, - or @ get a leading ', and the BOM keeps Excel on UTF-8.
3. Dark mode: the button is readable next to Done (screenshot 2).

Blocking:

  1. Merge conflicts with development. GitHub shows the branch as not mergeable, and a local merge of origin/development conflicts in PRGradingScreen.jsx and PRGradingScreen.module.css. #5491 (promote buttons under each reviewer) merged into development today and rewrote both files. Please merge development and check the Export button still sits correctly next to Done and 5491's promote buttons.

Question:
2. Which screen does task 34 mean? The button only appears where PRGradingScreen renders: /pr-grading-screen and /pr-grading-test, which both show hardcoded sample data (91NePRT, 5/18/2025), and the "Review for This Week" dialog that #5574 adds. The grading dashboard that shows the current review week (Oct 12 - Oct 18), /pr-grading-dashboard (PRGradingDashboard), has no Export button (screenshot 3). If coordinators are meant to export that weekly data, it may need to go there too. Worth confirming with Jae.

Minor:

  • URL.revokeObjectURL(url) runs right after link.click(). Chrome is fine with that, but some browsers cancel the download if the URL is revoked in the same tick; wrapping it in setTimeout(..., 0) is the usual safe pattern.

Requesting changes for the merge conflict.

1. Admin, light: /pr-grading-test (ComplexTeam) with Export to CSV next to Done

Image

2. Admin, dark: same screen, button readable

Image

3. Admin, light: /pr-grading-dashboard (current review week) has no Export button

Image

@muthapriyanka muthapriyanka added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Oct 15, 2026
AaditTrivedi
AaditTrivedi previously approved these changes Oct 15, 2026

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

Checked out the PR (no conflicts with development) and ran csvExport.test.js and PRGradingScreen.export.test.jsx: [5/5] passing.

Verified

  • Restores the Export to CSV button on the weekly PR grading screen, which an earlier merge (#5056) removed.
  • Every value is quoted with embedded quotes doubled, so commas, quotes, or line breaks in names and notes can't break the CSV columns.
  • Values pass through protectSpreadsheetValue, which guards against spreadsheet formula injection (cells starting with characters like = or +).
  • It exports the reviewers currently shown (filteredReviewers), joins multiple PR numbers with "; ", uses CRLF line endings for spreadsheet compatibility, and names the file by date range (weekly-pr-grading-<start>-to-<end>.csv).

Approving.

@rahulrubugunday rahulrubugunday 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 on Priyanka_weekly_pr_grading_csv at fb9507d as DevAdmin, with backend on development, in light and dark mode. No conflicts with development.

  • Export to CSV shows up next to Done on the weekly PR grading screen (91NePRT test team).
  • Clicking it downloads weekly-pr-grading-5-18-2025-to-5-25-2025.csv with one row per reviewer: name, PR reviewed count, PRs needed and PR numbers all match what's on screen.

Needs changes:

  1. The grades aren't in the export. Abi's PRs are graded Exceptional, Okay, Exceptional and Unsatisfactory on screen, but the CSV only has the PR numbers. The earlier export from #4934 had a Grades column, so it would be good to add that back.
  2. The grading screen doesn't work well in dark mode. The table headers (Reviewer Name, PR reviewed, PRs Needed, PR Numbers) and the grade table headers (PR Number, Exceptional, Okay, Unsatisfactory, Cannot find image) are light text on a white background, so they can't be read. The PR number chips next to each reviewer are also hard to read.
Image Image

Requesting changes.

AaditTrivedi
AaditTrivedi previously approved these changes Oct 17, 2026

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

Re-reviewed by Aadit Trivedi.

After the new commits "Defer CSV download URL cleanup" and "Include PR grades in CSV and fix grading dark mode": ran the CSV tests (6/6 passing). The new Grades column follows the same order as PR Numbers (joined with "; ") and goes through the same quoting and formula-injection protection as the other columns. Deferring URL.revokeObjectURL until after the click avoids browsers canceling the download. Everything from my earlier approval still holds.

Approving.

AlekyaJogini
AlekyaJogini previously approved these changes Oct 17, 2026

@AlekyaJogini AlekyaJogini 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 Alekya.

How I tested
Checked out the PR branch (commit 7d5a960) on Node 20.19.4 with the backend on development. Ran npx vitest run csvExport PRGradingScreen.export: 2 test files, 6 tests passed. Logged in as my Admin test account and opened the Weekly PR grading screen (91NePRT, 5/18/2025 to 5/25/2025) in dark mode. I only exported CSVs and did not add PRs or click Done.

Verified working

  • The Grades column is now in the CSV . Abi's grades match the screen: 3100 + 1410 Exceptional, 2045 Okay, 1876 + 2234 Exceptional, 3301 Unsatisfactory. The other reviewers have grades too, and Cari (0 PRs) has empty fields. The file name uses the date range (weekly-pr-grading-5-18-2025-to-5-25-2025.csv).

  • Dark mode is fixed the table headers, the grade table headers and the PR number chips are readable.

Image
  • Search filter: searching "abi" and exporting gives a CSV with only Abi's row.
  • With no matching reviewers ("No reviewers found") the export downloads a valid file with only the header row.
Image

Issues found
None

Not tested

  • Role filter
  • Adding a PR and exporting before Done

@iAbhi001
iAbhi001 self-requested a review October 18, 2026 03:03
iAbhi001
iAbhi001 previously approved these changes Oct 18, 2026

@iAbhi001 iAbhi001 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 on branch Priyanka_weekly_pr_grading_csv at commit 7d5a960 with backend on development as Admin across both light and dark mode, and confirmed all merge conflicts with development are resolved. All 6 tests across both test files pass cleanly. The Export to CSV button renders properly next to Done, the deferred object URL cleanup prevents download cancellation, and the exported file accurately reflects the on-screen date range and reviewer data. The newly restored Grades column correctly aligns with the PR entries, spreadsheet formula injection protections and value escaping are functioning as expected, search filtering limits the rows properly, and the earlier dark mode contrast issues on the headers and chips are fixed. Approving!

Image Image

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

Re-reviewed at 443413b (my earlier changes-requested review is on a8af74c).

Tested both screens in a browser in light and dark mode. Each component was rendered on its own with a mocked store, and the grading API was mocked, so nothing touched a real database. The vitest suites for PRGradingScreen/ and PRGradingDashboard/ pass (4 files, 19 tests).

Fixed since my last review:

  • The merge conflict is gone. GitHub reports the PR as mergeable.
  • The download URL is revoked in a setTimeout.
  • Export to CSV was added to the Team Alpha dashboard, which answers my question about task 34. The tooltip says the Review Week selector does not filter the records yet, which matches what the screen does.
  • The CSV now has a Grades column.

Downloaded files:

  • Screen (weekly-pr-grading-10-12-2026-to-10-18-2026.csv): "Abi","2","10","3100 + 1410; 2200","Okay; Exceptional","", "Ben =cmd","1","10","4100","Unsatisfactory","" and "Cleo","0","5","","","". Searching for "Abi" exports only Abi's row.
  • Dashboard (team-alpha-pr-grading-displayed-data.csv): "Alice","7","10","1070 + 1256; 2000","Exceptional; Okay","" and "Bob","2","8","3000","No Correct Image","". The count comes from the stored prsReviewed, as the code intends.

Blocking (dark mode):

  1. "PRs Needed" is unreadable in dark mode on the weekly screen. The numbers in that column (10 for Abi and Ben in screenshot 2) are rgb(51, 51, 51) on rgb(27, 42, 65). dm is now styles['dark-mode'], so the dark rules now apply, but .pr-grading-screen-td-needed has no dark-mode color. Please add one for the dark class (the other cells in that row already switch to light text). The Export to CSV and Done buttons are readable; the dashboard in dark mode (screenshot 4) is fine.

Heads up for merge order: this branch and #5630 both edit PRGradingScreen.jsx and PRGradingView.jsx, and a merge of the two conflicts in both files. Whichever lands second will need to resolve it.

Non-blocking: the dashboard CSV shows the stored grade name "No Correct Image" while the weekly screen labels it "Cannot find image". Fine for a data export, just worth knowing.

1. Weekly screen, light: Export to CSV next to Done

1-screen-light

2. Weekly screen, dark: the "PRs Needed" numbers (10) are barely visible

2-screen-dark

3. Dashboard, light

3-dashboard-light

4. Dashboard, dark

4-dashboard-dark

5. Dashboard, phone width

5-dashboard-phone

@iAbhi001
iAbhi001 self-requested a review October 23, 2026 05:11
iAbhi001
iAbhi001 previously approved these changes Oct 23, 2026

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

Re-tested locally on latest commit in both light and dark modes across the weekly PR grading screen and the Team Alpha PR grading dashboard.

The latest fix for the PRs Needed column contrast in dark mode works as expected, and the numbers are now clearly legible against the dark background. The Export to CSV button on both the weekly grading screen and the Team Alpha dashboard downloads cleanly with matching visible rows, properly aligned Grades columns, escaped values, formula injection protections, and deferred URL cleanup. All unit tests across PRGradingScreen and PRGradingDashboard continue to pass without conflicts with development.

Everything looks solid and functions properly. Approving the PR.

AnshShah-18
AnshShah-18 previously approved these changes Oct 24, 2026

@AnshShah-18 AnshShah-18 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested PR #5613 locally and everything I checked is working correctly. The Export to CSV button downloads the weekly PR grading data with the correct date-range filename, expected columns, reviewer information, PR numbers, and grades. I also verified that reviewer search and role filters are reflected correctly in the exported CSV, with only the visible filtered rows included. Everything I tested worked as expected.

Image Image Image

Approved—nice work!

@one-community one-community changed the title Add CSV export to weekly PR grading screen Priyanka - Add CSV export to weekly PR grading screen Oct 25, 2026
@muthapriyanka
muthapriyanka dismissed stale reviews from AnshShah-18 and iAbhi001 via 2006d9e October 26, 2026 00:22
@sonarqubecloud

Copy link
Copy Markdown

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

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.

8 participants