Skip to content

Ignore deleted entrants when recording races (Option 2 of 2) - #238

Open
TCKLZ wants to merge 2 commits into
racetimeGG:masterfrom
TCKLZ:tcklz/null-user-recording-bug-solution-2-ignore-deleted-users
Open

Ignore deleted entrants when recording races (Option 2 of 2)#238
TCKLZ wants to merge 2 commits into
racetimeGG:masterfrom
TCKLZ:tcklz/null-user-recording-bug-solution-2-ignore-deleted-users

Conversation

@TCKLZ

@TCKLZ TCKLZ commented Jun 27, 2026

Copy link
Copy Markdown

Summary

  • Allow race recording even when one or more entrants have deleted their account.
  • Exclude deleted entrants from the rating calculation so rate_race() does not dereference a null user.
  • Return early if no remaining entrants can be rated.

Testing

  • python manage.py check
  • python manage.py test racetime (0 tests found)
  • python -m py_compile racetime/models/race.py racetime/rating.py

Note
This changes scoring behavior: deleted entrants are ignored for rating purposes, so points are calculated from the remaining users.

Commit 2; Updated to keep the deleted-user guard for team races, since ignoring a deleted entrant there could imbalance teams and skew ratings.

Also added a check so non-team races are only recorded if at least two entrants with accounts remain after deleted users are ignored.

@TCKLZ TCKLZ changed the title Ignore deleted entrants when recording races Ignore deleted entrants when recording races (Option 2 of 2) Jun 27, 2026

@deains deains left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! We do need to account for a couple of extra cases to make this work though.

  1. If the race is a team race, the guard should remain in place. Recording a team race with one or more deleted users will lead to imbalanced teams and that will skew the points awfully.
  2. If the race has only one entrant left after accounting for deleted users, it should not be recorded. A race with a single entrant cannot be meaningfully scored.

@TCKLZ
TCKLZ requested a review from deains June 30, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants