Problem/Motivation

Add a "Statistics" page (tab next to the settings page) and show which path is used how often.

That allows investigating how many users use each path and allows detecting broken / dead settings, which can happen if a previously selectable route is removed.

The page should simply show a table which lists the route plus label and its count in the user settings.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

anybody created an issue. See original summary.

anybody’s picture

Issue tags: +Novice

Should be a relatively simple database query plus a controller.

ben280398 made their first commit to this issue’s fork.

ben280398’s picture

Added a "Statistics" page as a tab next to the settings page. The page displays a table showing:

Route label
Route path
Number of users with that preference

It also shows:

Deleted routes (routes in user data but no longer in config) - helps detect broken settings
Users with no preference set (using default)

Changes made

Added src/Controller/StatisticsController.php - Controller that queries the users_data table and builds the statistics table
Updated user_preference_login_redirect.routing.yml - Added route for /admin/config/people/user-preference-login-redirect/statistics

Updated user_preference_login_redirect.links.task.yml - Added tab link to settings page
Updated tests/src/Functional/UserPreferenceLoginRedirectTest.php - Added tests for statistics page

Merge Request is linked here for ease of tracking:
https://git.drupalcode.org/project/user_preference_login_redirect/-/merg...

anybody’s picture

Status: Active » Needs work

This is great!

Just move the database query into a helper service and use dependency injection to inject it as written in #3570994: Add a bulk "Set default" form and we can merge this!
Great work @ben280398 (while I'm quite sure AI helped a lot? ;))

Thanks!!

anybody’s picture

Thanks, commented!

anybody’s picture

Status: Needs work » Reviewed & tested by the community

Perfect @ben280398 - this looks great!

anybody’s picture

Status: Reviewed & tested by the community » Fixed

Merged so you can proceed on the other issues! :)

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.