Skip to content

Store and display driver aliases on name changes#268

Merged
fabieu merged 5 commits intomainfrom
copilot/store-driver-aliases
Nov 20, 2025
Merged

Store and display driver aliases on name changes#268
fabieu merged 5 commits intomainfrom
copilot/store-driver-aliases

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Track driver name changes across sessions by storing previous names as aliases in a dedicated table. Display the 5 most recent aliases in driver profiles and the admin drivers grid.

Changes

Database

  • New driver_alias table with driver_id, first_name, last_name, created_at
  • Foreign key to driver table with cascade delete
  • Indexed on driver_id and created_at DESC for efficient queries
  • Migrations for both PostgreSQL and SQLite

Backend

  • DriverAlias entity and MyBatis mapper for CRUD operations
  • DriverAliasService to fetch latest N aliases and insert new ones
  • Modified DriverService.upsertDriver() to detect name changes and persist old name as alias before updating
public void upsertDriver(Driver driver) {
    Driver existingDriver = driverMapper.findById(driver.getId());
    
    if (existingDriver != null) {
        boolean nameChanged = !Objects.equals(existingDriver.getFirstName(), driver.getFirstName()) 
                           || !Objects.equals(existingDriver.getLastName(), driver.getLastName());
        
        if (nameChanged) {
            // Store old name as alias before update
            driverAliasService.insertAlias(
                DriverAlias.builder()
                    .driverId(existingDriver.getId())
                    .firstName(existingDriver.getFirstName())
                    .lastName(existingDriver.getLastName())
                    .createdAt(Instant.now())
                    .build()
            );
        }
    }
    
    driverMapper.upsert(driver);
}

UI

  • LeaderboardDriverDetailView: Added "Known Aliases" section displaying up to 5 aliases as badges
  • LeaderboardDriversView: Added "Known Aliases" column to grid showing up to 5 aliases per driver as inline badges
  • Empty when no aliases exist (no visual clutter)
Original prompt

This section details on the original issue you should resolve

<issue_title>Store and display driver aliases</issue_title>
<issue_description>Instead of displaying only the last known driver alias, we want to store a driver alias into a dedicated database table called driver_alias when the first name or last name is different from the previous name based on the steam id during session import. We then want to display the lastest 5 driver aliases in the driver profile and in the leaderboard drivers view grid.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Store and display driver aliases in profiles and leaderboard Store and display driver aliases on name changes Nov 20, 2025
Copilot AI requested a review from fabieu November 20, 2025 16:27
@fabieu fabieu marked this pull request as ready for review November 20, 2025 17:13
@fabieu fabieu added the enhancement New feature or request label Nov 20, 2025
@fabieu fabieu force-pushed the copilot/store-driver-aliases branch from dc6632b to b1dc1f5 Compare November 20, 2025 17:22
@fabieu fabieu merged commit 905f044 into main Nov 20, 2025
1 check passed
@fabieu fabieu deleted the copilot/store-driver-aliases branch November 20, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Store and display driver aliases

2 participants