diff --git a/src/planscape/impacts/services.py b/src/planscape/impacts/services.py index ed23e13c4..9baf5b333 100644 --- a/src/planscape/impacts/services.py +++ b/src/planscape/impacts/services.py @@ -55,16 +55,16 @@ def upsert_treatment_prescriptions( treatment_plan: TreatmentPlanType, project_area: ProjectAreaType, stands: List[StandType], - action_type: ActionType, + action: ActionType, created_by: UserType, ) -> List[TreatmentPrescriptionEntityType]: - def upsert(treatment_plan, project_area, stand, action_type, user): + def upsert(treatment_plan, project_area, stand, action, user): upsert_defaults = { - "type": get_prescription_type(action_type), + "type": get_prescription_type(action), "created_by": user, "updated_by": user, "geometry": stand.geometry, - "action": action_type, + "action": action, } instance, created = TreatmentPrescription.objects.update_or_create( treatment_plan=treatment_plan, @@ -81,7 +81,7 @@ def upsert(treatment_plan, project_area, stand, action_type, user): lambda stand: upsert( treatment_plan=treatment_plan, project_area=project_area, - action_type=action_type, + action=action, user=created_by, stand=stand, ), diff --git a/src/planscape/impacts/tests/test_services.py b/src/planscape/impacts/tests/test_services.py index 1f91e4d83..23a1b5d93 100644 --- a/src/planscape/impacts/tests/test_services.py +++ b/src/planscape/impacts/tests/test_services.py @@ -52,7 +52,7 @@ def test_upsert_does_not_create_new_prescription(self): treatment_plan=self.treatment_plan, project_area=self.project_area, stands=[self.stand1], - action_type=TreatmentPrescriptionAction.HEAVY_THINNING_BURN, + action=TreatmentPrescriptionAction.HEAVY_THINNING_BURN, created_by=user, ) @@ -78,7 +78,7 @@ def test_upsert_creates_new_prescription(self): treatment_plan=self.treatment_plan, project_area=self.project_area, stands=[self.stand2], - action_type=TreatmentPrescriptionAction.HEAVY_THINNING_BURN, + action=TreatmentPrescriptionAction.HEAVY_THINNING_BURN, created_by=user, )