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 officer profile exception #385

Merged
merged 1 commit into from
Nov 26, 2023
Merged

Conversation

sea-kelp
Copy link
Collaborator

@sea-kelp sea-kelp commented Nov 12, 2023

Description of Changes

Fixes #384.

Fixes the exception currently thrown while rendering officer profiles

web_1           | 2023-11-12 06:38:46,920 INFO sqlalchemy.engine.Engine [generated in 0.00029s] {'param_1': 848}                                                                       
web_1           | [2023-11-12 06:38:46,924] ERROR in views: Error finding officer                                                                                                      
web_1           | Traceback (most recent call last):                                                                                                                                   
web_1           |   File "/usr/src/app/OpenOversight/app/main/views.py", line 313, in officer_profile                                                                                  web_1           |     officer.incidents.query.order_by(Incident.date.desc(), Incident.time.desc())                                                                                     web_1           |     ^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                          
web_1           | AttributeError: 'InstrumentedList' object has no attribute 'query'

This partially reverts changes in lucyparsons#1056 which moved sorting from the template to the view function.

Notes for Deployment

None!

Screenshots (if appropriate)

N/A

Tests and linting

No additional tests because the exception was being swallowed by the surrounding try-except but I checked the logs and made sure that the exception was present before my changes and was not after.

  • I have rebased my changes on main

  • just lint passes

  • just test passes

@sea-kelp sea-kelp requested a review from a team as a code owner November 12, 2023 07:15
Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Confirmed the error no longer appears locally.

@AetherUnbound AetherUnbound merged commit a9ac755 into main Nov 26, 2023
2 checks passed
@AetherUnbound AetherUnbound deleted the 384/fix-officer-profile-exception branch November 26, 2023 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fix officer profile exception
2 participants