OpenOversight icon indicating copy to clipboard operation
OpenOversight copied to clipboard

New Officer Form throws a bug when a description or note is added

Open McEileen opened this issue 4 years ago • 0 comments

Desired Outcome:

  • When an admin or AC creates an officer, if they include a description, the app successfully creates the officer
  • When an admin or AC creates an officer, if they include a description, the app successfully creates the officer

Current Outcome:

  • When an admin or AC creates an officer and includes a description, the app throws the below bug:
TypeError: 'description' is an invalid keyword argument for Description
File "/usr/src/app/OpenOversight/app/main/views.py", line 689, in add_officer
officer = add_officer_profile(form, current_user)
File "/usr/src/app/OpenOversight/app/utils.py", line 181, in add_officer_profile
date_updated=datetime.datetime.now())
  • When an admin or AC creates an officer and includes a note, the app throws the below bug:
TypeError: 'note' is an invalid keyword argument for Note
File "/usr/src/app/OpenOversight/app/main/views.py", line 689, in add_officer
officer = add_officer_profile(form, current_user)
File "/usr/src/app/OpenOversight/app/utils.py", line 170, in add_officer_profile
date_updated=datetime.datetime.now())

Steps to Reproduce:

  1. Log in as an admin or AC
  2. Create an officer. Include a note or description in the new officer form. (If you are logged in as an AC, you will only be able to create officers for your department.)
  3. Behold the error message.

Relevant areas of the codebase:

  • the method add_officer_profile in main/views.py
  • the method add_officer in utils.py

McEileen avatar Oct 18 '20 20:10 McEileen