OpenOversight
OpenOversight copied to clipboard
589/add year selector
Status
Ready for review
Description of Changes
Fixes #604 and #589 .
Changes proposed in this pull request:
- Add
last_employment_date
andlast_employment_details
fields to all officers. - Add
last_employment_date
andlast_employment_details
fields to the add/edit officer forms. - Add a
year
dropdown selector to the page that displays all of a department's officers.
Notes for Deployment
Screenshots (if appropriate)
Tests and linting
-
[x] I have rebased my changes on current
develop
-
[x] pytests pass in the development environment on my local machine (There are two failing tests,
test_admin_can_disable_user
andtest_lastname_capitalization
, however, they were failing before this PR. -
[x]
flake8
checks pass
I'm not understanding what the 'Year' dropdown in the filter section does. Does that mean year of employment?
Yes, so for example, if someone were trying to find an officer they interacted with in 2018, they could select "2018" in the dropdown. @camfassett pointed out in this issue that as we obtain rosters for 2019, we want historic data to remain accessible to the public. It's a good way to see how officer's assignments or roster sizes change over time.
Could someone please review this when they get a chance? Thanks! :pray:
@r4v5 @redshiftzero Could one of you please review this PR? @dismantl already reviewed it once and his main feedback was to remove the hardcoded lists of years and to instead use a QuerySelectField
. Thank you! :pray:
~~I found a bug in this PR where officers that started working for a department after the year selected would still appear in results. For example, if a user selected "1970" from the drop-down selector, an officer that started working in "2005" would still appear in the results.
I will fix this bug and then ping someone for a re-review.~~
The PR is ready for re-review!
I fixed the bug where the year selector returned officers who worked for the department after the selected year. I also fixed a bug where adding a new officer to the department would cause the year_choices()
method to return duplicate years.
@redshiftzero @r4v5 @dismantl @b-meson @brianmwaters Your thoughts are appreciated.
Still working on my in-depth code review here, but I noticed in the meantime that the "year" selector only appears in the filter bar on the left-hand side of the officer listing page, but not on the "find an officer" page (e.g, /find
). This seems to sort of make sense, but just want to verify that that's by design and not an oversight (ba-dum tiss)
Still working on my in-depth code review here, but I noticed in the meantime that the "year" selector only appears in the filter bar on the left-hand side of the officer listing page, but not on the "find an officer" page (e.g,
/find
). This seems to sort of make sense, but just want to verify that that's by design and not an oversight (ba-dum tiss)
Yep, I only put the "year" selector on the browse page, since that's where the original issue, #589, requested it. Still, thanks for opening (ba-dum tiss?) my eyes to this.
I responded to feedback. Here's a video of the feature in action.
I responded to feedback. Thanks to everyone who offered their thoughts.