From 8ad9a90e7c9fed6b894c17157799d2b1beec6883 Mon Sep 17 00:00:00 2001 From: Ryan Park Date: Mon, 10 Jun 2024 22:35:36 -0400 Subject: [PATCH] Updates merge_employment_records to include Unit model --- backend/database/models/employment.py | 5 +---- backend/routes/agencies.py | 1 - backend/routes/officers.py | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/database/models/employment.py b/backend/database/models/employment.py index 673efb2ee..27424c2d4 100644 --- a/backend/database/models/employment.py +++ b/backend/database/models/employment.py @@ -66,7 +66,6 @@ def get_highest_rank(records: list[Employment]): def merge_employment_records( records: list[Employment], - unit: str = None, currently_employed: bool = None ): """ @@ -86,17 +85,15 @@ def merge_employment_records( """ earliest_employment, latest_employment = get_employment_range(records) highest_rank = get_highest_rank(records) - if unit is None: - unit = records[0].unit if currently_employed is None: currently_employed = records[0].currently_employed return Employment( officer_id=records[0].officer_id, agency_id=records[0].agency_id, + unit_id=records[0].unit_id, badge_number=records[0].badge_number, earliest_employment=earliest_employment, latest_employment=latest_employment, - unit=unit, highest_rank=highest_rank, currently_employed=currently_employed, ) diff --git a/backend/routes/agencies.py b/backend/routes/agencies.py index 83894ef10..2de831885 100644 --- a/backend/routes/agencies.py +++ b/backend/routes/agencies.py @@ -231,7 +231,6 @@ def add_officer_to_agency(agency_id: int): employment.agency_id = agency_id employment = merge_employment_records( employments.all() + [employment], - unit=record.unit, currently_employed=record.currently_employed ) diff --git a/backend/routes/officers.py b/backend/routes/officers.py index 935438674..184c8e5ec 100644 --- a/backend/routes/officers.py +++ b/backend/routes/officers.py @@ -304,7 +304,6 @@ def update_employment(officer_id: int): employment.officer_id = officer_id employment = merge_employment_records( employments.all() + [employment], - unit=record.unit, currently_employed=record.currently_employed )