Problem/Motivation

QuotaManager::getDashboardData() and RollupManager::getMonthAggregates() group per-user usage with no ORDER BY, so rows come back in database order, not by usage.

The "Sort by" buttons only reorder rows already in the DOM. Since the table is paginated in SQL, a sort only applies within the current page.

Proposed resolution

Move sorting to SQL: a sort column/direction query arg, validated against an allow-list (calls, cost, tokens used, editor name), applied as ORDER BY before the pager's LIMIT/OFFSET, in both the current-month and rolled-up-month queries. Replace the client-side sort buttons with links that set the query arg and reload.

AI assistance

Yes.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

codeitwisely created an issue. See original summary.

  • codeitwisely committed 005779bb on 1.0.x
    Issue #3613214 by codeitwisely: Per-user usage dashboard sort order and...
codeitwisely’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

codeitwisely’s picture

Status: Fixed » Closed (fixed)