fecgov / fecfile-web-api

Back-end API for FECfile application
7 stars 2 forks source link

Download .fec file process is throwing a 500 error #901

Closed mjtravers closed 2 weeks ago

mjtravers commented 1 month ago

Downloading a .fec file through the UI kabob menu is failing with a 500 error from the api.

The issue is that the code needs to account for reports that do not have coverage_from_date

See problem code here: https://github.com/fecgov/fecfile-web-api/blob/develop/django-backend/fecfiler/web_services/summary/tasks.py#L24 image

Error from log: 10:50:41.689: [APP/PROC/WEB.1] level='error' event='task_failed' logger='django_structlog.celery.receivers' error="'NoneType' object has no attribute 'year'" exception='Traceback (most recent call last):\n File "/home/vcap/deps/0/python/lib/python3.10/site-packages/celery/app/trace.py", line 451, in trace_task\n R = retval = fun(*args, **kwargs)\n File "/home/vcap/deps/0/python/lib/python3.10/site-packages/celery/app/trace.py", line 734, in __protected_call__\n return self.run(*args, **kwargs)\n File "/home/vcap/app/django-backend/fecfiler/web_services/summary/tasks.py", line 43, in calculate_summary\n reports_to_recalculate = get_reports_to_calculate(primary_report)\n File "/home/vcap/app/django-backend/fecfiler/web_services/summary/***tasks.py", line 24***, in get_reports_to_calculate\n report_year = primary_report.coverage_from_date.year\nAttributeError: \'NoneType\' object has no attribute \'year\'' task_id='75f67477-216f-416c-9b68-104a3f63aa48' ip='216.15.29.108' request_id='a344a0e0-e4bf-4996-9b23-fdc50fc2908c' user_id='83f441d0-f5a8-41b4-ada2-f31879f3143c' _record= _from_structlog=True

QA Notes

null

DEV Notes

null

Design

null

mjtravers commented 1 month ago

Passes CR. Sending to QA.

WiseQA commented 4 weeks ago

QA review verified bug fixed for download .fec file process 500 error.

Selected Form 24, then selected "Download as .fec".

Image


Download populated correctly.

Image


Repeat steps above for testing of Form 1M and Form 3x. All three reports are working correctly.

QA Review Completed. Moved to Stage Ready.

exalate-issue-sync[bot] commented 2 weeks ago

Aurelia Khorsand commented: Sprint accepted 6/18/2024 during Sprint Review.