goodtune / vitriolic

This project unifies the various sub-projects Touch Technology has created over the years that were intended to be reusable in isolation, but in practice never stood alone for long.
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fail to add Referee appointments with `edit_match` view related to live streaming feature #80

Open goodtune opened 6 days ago

goodtune commented 6 days ago

We have a regression - when trying to perform referee appointments on a match, there are issues in two states.

Firstly, when the Season is set as live_stream=False and has no YouTube configuration, the videos field is shown on the edit_match form; but it is required. Trying to add referees will fail at the UI because the requiredness of the form field will block the submission.

The second is when you turn live_stream=True; while the form will adapt and stop showing the videos field, it throws an exception on submission:

During handling of the above exception (Redirect matching query does not exist.), another exception occurred:
  File "/workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/tournamentcontrol/competition/decorators.py", line 184, in _decorated
    return f(request, *args, **kwargs)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
    return view_func(request, *args, **kwargs)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/tournamentcontrol/competition/admin.py", line 1637, in edit_match
    return self.generic_edit(
  File "/workspace/.heroku/python/lib/python3.9/site-packages/touchtechnology/common/sites.py", line 507, in generic_edit
    res = pre_save_callback(form.instance)
  File "/workspace/.heroku/python/lib/python3.9/site-packages/tournamentcontrol/competition/admin.py", line 1623, in pre_save_callback
    season.youtube.liveBroadcasts()
  File "/workspace/.heroku/python/lib/python3.9/site-packages/googleapiclient/discovery.py", line 1114, in method
    raise TypeError('Missing required parameter "%s"' % name)
goodtune commented 6 days ago

Some useful example data to try and reproduce in a test case:

Exception Type: TypeError at /admin/fixja/competition/1/seasons/53/division/232/stage/472/match/7616/
Exception Value: Missing required parameter "id"
Raised during: tournamentcontrol.competition.admin.edit_match
Request information:
USER: Gary Reynolds

GET: No GET data

POST:
csrfmiddlewaretoken = 'QEtdZJDHuF0AU3Lghk7w0nkN5K3gjkXNi1ZbVlJ3NkZnzTsQNe6ttGjWbR5twwsZ'
stage_group = '129'
home_team = '1296'
away_team = '1297'
referees = '523'
label = ''
round = '1'
date = '15/07/2024'
include_in_ladder = '1'
live_stream = '0'
live_stream_thumbnail = ''

This is for the second failure mode.

Curiously, there were multiple referees added in the UI - not sure why the data shows referees = '523' (i.e. a single entry)?