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

fix service #1709

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/planscape/impacts/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
),
Expand Down
4 changes: 2 additions & 2 deletions src/planscape/impacts/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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,
)

Expand Down
Loading