Skip to content

Correctly sort players by points when joining a new room#452

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/correctly-sort-players-by-points
Closed

Correctly sort players by points when joining a new room#452
Copilot wants to merge 2 commits intomainfrom
copilot/correctly-sort-players-by-points

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

When a player reconnected to a room (isNew=false), the join handler only updated CSS classes and username text manually — skipping upsertPlayerItem and sortPlayerListGroup. This left the list unsorted and the player item stale for all connected clients.

Changes

  • client/play/mp/MultiplayerTossupBonusClient.js: Collapsed the isNew branch in the join handler — both new and reconnecting players now go through upsertPlayerItem + sortPlayerListGroup. The server sets user.online = true before broadcasting join, so upsertPlayerItem renders the correct online state without special-casing.
// Before
if (isNew) {
  user.celerity = user.celerity.correct.average;
  upsertPlayerItem(user, { ... });
  this.sortPlayerListGroup();
} else {
  document.getElementById(`list-group-${userId}`).classList.remove('offline');
  document.getElementById('points-' + userId).classList.add('bg-success');
  document.getElementById('points-' + userId).classList.remove('bg-secondary');
  document.getElementById('username-' + userId).textContent = username;
}

// After
user.celerity = user.celerity.correct.average;
upsertPlayerItem(user, { ... });
this.sortPlayerListGroup();

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • qbreader2.z35tynb.mongodb.net
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/website/website/node_modules/.bin/mocha (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Correctly sort players by points when joining a new room</issue_title>
<issue_description></issue_description>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: geoffrey-wu <42471355+geoffrey-wu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix sorting of players by points when joining a new room Correctly sort players by points when joining a new room Mar 1, 2026
@geoffrey-wu geoffrey-wu closed this Mar 9, 2026
@geoffrey-wu geoffrey-wu deleted the copilot/correctly-sort-players-by-points branch March 9, 2026 03:51
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.

Correctly sort players by points when joining a new room

2 participants