Skip to content

[#345] Sort individual form responses view by time submitted, not by name#355

Merged
DVidal1205 merged 4 commits intomainfrom
blade/response-sorting
Feb 10, 2026
Merged

[#345] Sort individual form responses view by time submitted, not by name#355
DVidal1205 merged 4 commits intomainfrom
blade/response-sorting

Conversation

@mchdich
Copy link
Contributor

@mchdich mchdich commented Feb 10, 2026

Why

/form/responses gets all responses from a form and displays them in alphabetical order. it should be chronological, starting with the first person.

What

Issue(s): #345

Sorts responses by time submitted rather than name.

Test Plan

Merge me twin.

Checklist

  • Database: No schema changes, OR I have contacted the Development Lead to run db:push before merging
  • Environment Variables: No environment variables changed, OR I have contacted the Development Lead to modify them on Coolify BEFORE merging.

Summary by CodeRabbit

  • Bug Fixes
    • Admin responses view: grouped user responses now sort by each group’s earliest submission time rather than alphabetically by user name, so submission order is clearer for administrators.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Sorting logic in PerUserResponsesView.tsx is updated to order grouped user responses chronologically by the earliest submission timestamp instead of alphabetically by user name, affecting only presentation order without changing data collection or display logic.

Changes

Cohort / File(s) Summary
Response Sorting Order
apps/blade/src/app/admin/forms/[slug]/responses/_components/PerUserResponsesView.tsx
Changed sort key from user name (firstName/lastName) to chronological order using the earliest submittedAt timestamp within each user group, defaulting to 0 when timestamps are missing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

Bug

🚥 Pre-merge checks | ✅ 3 | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title exceeds the 72-character requirement at 73 characters and clearly describes the main change: sorting responses by submission time instead of by name. Shorten the title to 72 characters or fewer. Consider: '[#345] Sort responses by submission time' (41 chars) or '[#345] Sort by time submitted, not name' (40 chars).
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
No Typescript Escape Hatches ❓ Inconclusive Unable to execute shell commands to analyze the PerUserResponsesView.tsx file for TypeScript escape hatches. Please provide the file contents or pull request diff so I can check for 'any' types, @ts-ignore, @ts-expect-error, and non-null assertions.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
No Hardcoded Secrets ✅ Passed Comprehensive pattern-matching scan across all TypeScript/JavaScript files found no hardcoded secrets, API keys, passwords, or tokens. The PR's logic change poses no risk.
Validated Env Access ✅ Passed The modified file PerUserResponsesView.tsx contains no direct process.env usage and follows the codebase convention of centralizing environment variable validation in env.ts files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch blade/response-sorting

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@mchdich mchdich self-assigned this Feb 10, 2026
@mchdich mchdich added Minor Small change - 1 reviewer required Blade Change modifies code in Blade app labels Feb 10, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@apps/blade/src/app/admin/forms/`[slug]/responses/_components/PerUserResponsesView.tsx:
- Around line 93-96: The sort currently uses the first element of each user's
array (a[0]/b[0]) which breaks if responses aren't chronological; update the
sort in the users assignment (the callback used on Object.values(groupedByUser))
to compute each group's earliest submittedAt by scanning the group's items
(e.g., reduce or Math.min over parsed timestamps) and compare those earliest
times (timeA vs timeB) instead of a[0]/b[0], ensuring users are ordered by their
earliest submission.

Copy link
Contributor

@DVidal1205 DVidal1205 left a comment

Choose a reason for hiding this comment

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

lgtm. congrats on first PR

@DVidal1205 DVidal1205 added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit 1e7c852 Feb 10, 2026
8 checks passed
@DVidal1205 DVidal1205 deleted the blade/response-sorting branch February 10, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blade Change modifies code in Blade app Minor Small change - 1 reviewer required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants