esitarski/RaceDB

Unable to add participant under multiple categories via UI

Closed this issue · 3 comments

Hi, I'm getting RaceDB set back up for this year's races.

I'd like to use the feature where you can add a rider to a competition multiple times, to add them under different categories.
However, each time I'm trying this, the API call ParticipantAddToCompetitionDifferentCategory throws a DoesNotExist error: Participant matching query does not exist.

Steps to reproduce:

  • Create a competition
  • Create a license holder
  • Competition > Participant Manual Add
  • Set participants category
  • Click 'Add Category' button at the bottom
  • Confirm that you'd like to add another category

Instead of having the rider added to the competition again, I'm getting the attached error:

Environment:


Request Method: GET
Request URL: http://localhost:8000/RaceDB/Competitions/CompetitionDashboard/1/ParticipantManualAdd/1//ParticipantAddToCompetitionDifferentCategory/1/16/

Django Version: 3.2.6
Python Version: 3.9.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_extensions',
 'crispy_forms',
 'core')
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/RaceDB/core/views_common.py", line 108, in wrap
    response = response or decorated_func( request, *args, **kwargs )
  File "/RaceDB/core/WriteLog.py", line 90, in new_f
    return f( *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/RaceDB/core/participant.py", line 469, in ParticipantAddToCompetitionDifferentCategory
    participant.save()
  File "/RaceDB/core/models.py", line 3699, in save
    setattr( self, f, (getattr(self, f) or '').strip() )
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query_utils.py", line 144, in __get__
    instance.refresh_from_db(fields=[field_name])
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 637, in refresh_from_db
    db_instance = db_instance_qs.get()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(

Exception Type: DoesNotExist at /RaceDB/Competitions/CompetitionDashboard/1/ParticipantManualAdd/1//ParticipantAddToCompetitionDifferentCategory/1/16/
Exception Value: Participant matching query does not exist.

I noticed some of those files might have been updated in the last 15 days (but I didn't dig into git history), so I've tried this on latest, beta, and I found a published Docker tag from 20-30 days ago, and found the same issue on all versions tried.

I have managed to add a participant under multiple categories by making a pre-reg spreadsheet, but that's going to be a show-stopper during registration.

That was such a fast fix, thank you so much! I've got a second bug with a different screen that I'll create another issue for, but I just tested and this now works perfectly!

Closing issue.