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

Address edit Department error #1048

Merged
merged 8 commits into from
Sep 3, 2023
Merged

Address edit Department error #1048

merged 8 commits into from
Sep 3, 2023

Conversation

michplunkett
Copy link
Collaborator

@michplunkett michplunkett commented Aug 30, 2023

Description of Changes

I removed the created_by field from the from on editing a Department.

Tests and linting

  • This branch is up-to-date with the develop branch.
  • pytest passes on my local development environment.
  • pre-commit passes on my local development environment.

@michplunkett michplunkett marked this pull request as draft August 30, 2023 18:03
@michplunkett michplunkett self-assigned this Aug 30, 2023
@@ -675,7 +675,6 @@ def redirect_add_department():
@admin_required
def add_department():
form = DepartmentForm()
form.created_by = current_user.get_id()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was in add_department, but it certainly doesn't belong there as the field no longer exists.

Screenshot 2023-08-30 at 1 31 33 PM

Comment on lines +529 to +530
assert department.created_by == user.id
assert department.last_updated_by == user.id
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Assert both fields are populated upon creation.

@@ -692,6 +695,8 @@ def test_admin_can_edit_police_department(mockdata, client, session):
edit_state_department = Department.query.filter_by(name=CorrectedPD.name).one()
assert edit_state_department.short_name == CorrectedPD.short_name
assert edit_state_department.state == CorrectedPD.state
assert edit_state_department.last_updated_by == user.id
assert edit_state_department.last_updated_at > edit_state_department.created_at
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Assert that the last_updated_at value is greater than the created_at value.

@michplunkett michplunkett marked this pull request as ready for review August 30, 2023 18:37
@sea-kelp
Copy link
Collaborator

sea-kelp commented Aug 30, 2023

Would you mind adding a test for this? I definitely would have expected one of our tests to have picked this up

@michplunkett
Copy link
Collaborator Author

michplunkett commented Aug 31, 2023

Which error specifically? I checked the behavior of the app manually and via tests, and couldn't find the bug. It ends up that's because it wasn't a bug in the current version, but one that was fixed in one of the last 5 PRs.

@michplunkett
Copy link
Collaborator Author

Can you recheck this PR when you get a chance, @sea-kelp?

Copy link
Collaborator

@sea-kelp sea-kelp left a comment

Choose a reason for hiding this comment

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

Looks good!

@michplunkett michplunkett merged commit a28a64f into develop Sep 3, 2023
2 checks passed
@michplunkett michplunkett deleted the fix_edit_departments branch September 3, 2023 03:20
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Sep 25, 2023
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Sep 25, 2023
sea-kelp pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Oct 9, 2023
AetherUnbound pushed a commit to OrcaCollective/OpenOversight that referenced this pull request Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants