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 4 months ago

goodtune commented 4 months 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 4 months 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)?

goodtune commented 4 months ago

The problem had seemed to go away once I linked up the live streaming setup (not closing the bug for that, it was hoped to be a work around) but the following error is still occurring when trying to manage referee appointments on any match that doesn't have a video link (ie. will not be streamed).

Internal Server Error: /admin/fixja/competition/1/seasons/53/division/234/stage/474/match/8286/

TypeError at /admin/fixja/competition/1/seasons/53/division/234/stage/474/match/8286/
Missing required parameter "id"

Request Method: POST
Request URL: https://www.internationaltouch.org/admin/fixja/competition/1/seasons/53/division/234/stage/474/match/8286/
Django Version: 4.2.13
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.9.18
Python Path: ['/workspace', '/workspace/.heroku/python/bin', '/workspace', '/workspace/.heroku/python/lib/python39.zip', '/workspace/.heroku/python/lib/python3.9', '/workspace/.heroku/python/lib/python3.9/lib-dynload', '/workspace/.heroku/python/lib/python3.9/site-packages']
Server time: Sat, 06 Jul 2024 15:30:38 +0000

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)

Exception Type: TypeError at /admin/fixja/competition/1/seasons/53/division/234/stage/474/match/8286/
Exception Value: Missing required parameter "id"
Raised during: tournamentcontrol.competition.admin.edit_match
Request information:
USER: Bill Ker

GET: No GET data

POST:
csrfmiddlewaretoken = 'rUIiezbHG42OIyFjdCiEmsDrQPH8IL3SjsAVq28iHV3vxtKbH76fxlHsWS1jRvYf'
home_team = '1337'
away_team = '1346'
referees = '698'
label = ''
round = '1'
date = '2024-07-15'
include_in_ladder = '1'
live_stream = '0'
live_stream_thumbnail = ''