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 optional value #449

Merged
merged 1 commit into from
Feb 14, 2025
Merged
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
7 changes: 5 additions & 2 deletions database/ryhti_client/ryhti_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class RyhtiPlan(TypedDict, total=False):
otherPlanMaterials: List
planReport: Dict | None
generalRegulationGroups: List[Dict]
planDescription: str
planDescription: str | None
planObjects: List
planRegulationGroups: List
planRegulationGroupRelations: List
Expand Down Expand Up @@ -778,7 +778,10 @@ def get_plan_dictionary(self, plan: models.Plan) -> RyhtiPlan:
plan_dictionary["scale"] = plan.scale
plan_dictionary["geographicalArea"] = self.get_geojson(plan.geom)
# For reasons unknown, Ryhti does not allow multilanguage description.
plan_dictionary["planDescription"] = plan.description.get("fin")
plan_description = (
plan.description.get("fin") if isinstance(plan.description, dict) else None
)
plan_dictionary["planDescription"] = plan_description

# Here come the dependent objects. They are related to the plan directly or
# via the plan objects, so we better fetch the objects first and then move on.
Expand Down