GSE-CCL / getting-unstuck-web

The Getting Unstuck web app from 2020.
https://gettingunstuck.gse.harvard.edu
MIT License
2 stars 0 forks source link

Enforce checked radio selection with schema comparison basis #184

Open jsarchibald opened 4 years ago

jsarchibald commented 4 years ago

Replicate here

When accessing /project/236294075/view, there's a 500 error. The traceback says:

Traceback (most recent call last):
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/webadmin/getting-unstuck-web/env/lib/python3.8/site-packages/flask_caching/__init__.py", line 410, in decorated_function
    return f(*args, **kwargs)
  File "/home/webadmin/getting-unstuck-web/app.py", line 291, in project__id
    return display.get_project_page(pid, CACHE_DIRECTORY)
  File "/home/webadmin/getting-unstuck-web/lib/display.py", line 222, in get_project_page
    code, sprite = get_code_excerpt(example, sc)
  File "/home/webadmin/getting-unstuck-web/lib/display.py", line 38, in get_code_excerpt
    option = project["validation"]["required_text"][sc["comparison_basis"]["priority"]]
TypeError: list indices must be integers or slices, not NoneType
jsarchibald commented 4 years ago

The issue here is saving schemas with a comparison basis but without prioritized categories, blocks, etc. So should change schema saving code to require both.