Skip to content

Add server-side column sorting to the Tickets page#72

Open
NanakiEmi wants to merge 3 commits into
mintopia:developfrom
NanakiEmi:tickets-column-sorting
Open

Add server-side column sorting to the Tickets page#72
NanakiEmi wants to merge 3 commits into
mintopia:developfrom
NanakiEmi:tickets-column-sorting

Conversation

@NanakiEmi

Copy link
Copy Markdown

Problem

The user Tickets page (TicketController@index) paginates with no orderBy, so tickets are shown in database insertion order. With 15 rows per page a user's most recent tickets can land on page 2, and the Reference / Type / Seat / Event columns can't be reordered.

Change

Adds server-side sorting to /tickets, mirroring the existing Admin tickets convention (same order / order_direction query params and the shared partials/_sortheader.blade.php partial):

  • Sensible default order — newest event first (order=event, order_direction=desc), so recent tickets appear on page 1.
  • Sortable columns — Reference, Type, Seat, Event; click a header to sort ascending/descending. Sort keys are whitelisted, so only known columns ever reach the query builder.
  • Pagination preserves the sort via ->appends().
  • Joins are applied only for the active sort column; ->select('tickets.*') avoids column collisions and a tickets.id tiebreaker keeps ordering deterministic. Existing eager loads and the non-admin draft filter are unchanged.

Tests

  • Unit tests for TicketController@index: default order, each column ascending/descending, invalid order/direction fall back to defaults, pagination preserves the sort, and seat sort keeps unseated tickets.
  • Feature test that the Tickets page renders sortable header links and rows in the requested order.
  • Full suite passes; phpcs clean.

🤖 Generated with Claude Code

NanakiEmi added 3 commits July 6, 2026 10:31
Adds whitelisted order/order_direction query param handling to
TicketController@index, mirroring the existing admin tickets sort
convention (default: newest event first). Covers reference, type,
seat, and event columns with join-based sorting and a stable
tickets.id tiebreaker; invalid inputs fall back to the default.
Reuse the existing partials/_sortheader partial for the Reference,
Type, Seat, and Event column headers so they become clickable sort
links (Event defaults to desc on first click for newest-first).
Adds an HTTP feature test proving the headers render sort links and
that rows are ordered accordingly.
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (dbcf2c2) to head (7b8dfd8).

Additional details and impacted files
@@             Coverage Diff             @@
##             develop       #72   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity      1155      1163    +8     
===========================================
  Files            136       136           
  Lines           4053      4036   -17     
===========================================
- Hits            4053      4036   -17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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