• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lucyparsons / OpenOversight / 5756308443 / 1
89%
develop: 89%

Build:
DEFAULT BRANCH: develop
Ran 03 Aug 2023 10:41PM UTC
Files 86
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Aug 2023 10:36PM UTC coverage: 88.49%. Remained the same
5756308443.1

push

github

web-flow
Fix adding duplicate officers to incidents (#1006)

## Description of Changes
Merging fix https://github.com/OrcaCollective/OpenOversight/pull/347
upstream.

**Original PR description**:
Only add new officers to incidents.

When a user edits an incident currently, we retrieve the Incident from
the database and append all officers in the form to that Incident. This
led to sqlalchemy trying to insert duplicate rows into the
officer_incidents association table.

As far as I can tell, this was silently ignored by sqlalchemy in the
past and no unexpected rows were created. With the upgrade to sqlalchemy
2.0.19 (https://github.com/OrcaCollective/OpenOversight/pull/344), the
library appears to have started raising exceptions related to this
behavior.

This change checks to see whether an officer already exists in
Incident.officers before adding them so as to not add duplicate
officers.

## Notes for Deployment
N/A

## Screenshots (if appropriate)
N/A

## Tests and linting
 - [x] This branch is up-to-date with the `develop` branch.
 - [x] `pytest` passes on my local development environment.
 - [x] `pre-commit` passes on my local development environment.

7427 of 8393 relevant lines covered (88.49%)

0.88 hits per line

Source Files on job 5756308443.1
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 5756308443
  • cb63dfed on github
  • Prev Job for on develop (#5754819670.1)
  • Next Job for on develop (#5756452079.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc