Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash exporting org audit #1200

Merged
merged 1 commit into from
Feb 3, 2025
Merged

Conversation

mbarton
Copy link
Member

@mbarton mbarton commented Feb 3, 2025

and add some logging so we can go and look and see which field is wrong.

Crash logs:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/contrib/admin/options.py", line 718, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 188, in _view_wrapper
    result = _process_exception(request, e)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 186, in _view_wrapper
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/decorators/cache.py", line 80, in _view_wrapper
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/contrib/admin/sites.py", line 241, in inner
    return view(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 48, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 188, in _view_wrapper
    result = _process_exception(request, e)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/utils/decorators.py", line 186, in _view_wrapper
    response = view_func(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/contrib/admin/options.py", line 2034, in changelist_view
    response = self.response_action(
              
  File "/usr/local/lib/python3.11/site-packages/django/contrib/admin/options.py", line 1666, in response_action
    response = func(self, request, queryset)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/epilepsy12/admin.py", line 153, in download
    data = export_submission_period_as_csv(submission_period)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/epilepsy12/organisational_audit.py", line 160, in export_submission_period_as_csv
    selected_choices = list(value)
                       ^^^^^^^^^^^

Exception Type: TypeError at /admin/epilepsy12/organisationalauditsubmissionperiod/
Exception Value: 'NoneType' object is not iterable

and add some logging so we can go and look and see which field is wrong
@mbarton mbarton self-assigned this Feb 3, 2025
@mbarton mbarton merged commit 5d20bab into live Feb 3, 2025
2 checks passed
@mbarton mbarton deleted the mbarton/crash-downloading-org-audit branch February 3, 2025 12:54
@mbarton
Copy link
Member Author

mbarton commented Feb 3, 2025

Overdue on STAGING, LIVE (merged by @mbarton 30 minutes and 4 seconds ago) What's gone wrong?

@mbarton
Copy link
Member Author

mbarton commented Feb 3, 2025

Seen on STAGING (merged by @mbarton 31 minutes and 8 seconds ago) Please check your changes!

@mbarton
Copy link
Member Author

mbarton commented Feb 3, 2025

Seen on LIVE (merged by @mbarton 31 minutes and 13 seconds ago) Please check your changes!

@mbarton
Copy link
Member Author

mbarton commented Feb 3, 2025

The crash happened because we had seeded data from that trust from the previous year but they had not submitted any new data, so the new questions were None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant