Skip to content

Add confirmed player duplicates tracking and admin API#586

Draft
benckx with Copilot wants to merge 2 commits into
masterfrom
copilot/properly-process-db-player-duplicates
Draft

Add confirmed player duplicates tracking and admin API#586
benckx with Copilot wants to merge 2 commits into
masterfrom
copilot/properly-process-db-player-duplicates

Conversation

Copilot AI commented May 13, 2026

Copy link
Copy Markdown
Contributor

Player duplicates were only detected heuristically via name variations at query time with no way to persist confirmed relationships. This adds a formal DB entity to record confirmed duplicates and uses them in game stats aggregation.

Schema

New table reference_player_duplicate(player_id PK → reference_player, is_duplicate_of → reference_player) where player_id is the duplicate and is_duplicate_of is the canonical entry.

DAO (ReferencePlayerDaoService)

  • savePlayerDuplicate — upsert (conflict-update) a duplicate relationship
  • findConfirmedDuplicatesOf — all duplicates for a canonical player
  • findCanonicalPlayerFor — canonical player for a given duplicate
  • deletePlayerDuplicate / listAllPlayerDuplicates

Service layer (DatabaseService)

fetchPlayerGameStats now checks confirmed DB duplicates first; falls back to name-based heuristics only when none are registered.

Admin API

New endpoints at /api/admin/analytics/player-duplicates:

  • GET — list all confirmed duplicates with canonical names
  • POST — register a duplicate (RegisterPlayerDuplicateRequest: {playerId, isNewDuplicateOf})
  • DELETE — remove a relationship (DeletePlayerDuplicateRequest: {playerId})

registerPlayerDuplicate validates against self-references and cycles (canonical player must not itself be a duplicate; duplicate must not already serve as canonical for others).

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add logic to process database player duplicates Add confirmed player duplicates tracking and admin API May 13, 2026
Copilot finished work on behalf of benckx May 13, 2026 07:19
Copilot AI requested a review from benckx May 13, 2026 07:19
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.

properly process db player duplicates

2 participants