From 4f4ddc8b4cb3339218e6b3f7859b1557d2a9a29c Mon Sep 17 00:00:00 2001 From: hatim dinia Date: Thu, 28 Mar 2024 18:15:35 +0100 Subject: [PATCH] fix(bc): wrong key access for `filter_year_by_year` and `filter_synthesis` --- antarest/study/business/binding_constraint_management.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/antarest/study/business/binding_constraint_management.py b/antarest/study/business/binding_constraint_management.py index b2fd6ff35c..7c7fc99548 100644 --- a/antarest/study/business/binding_constraint_management.py +++ b/antarest/study/business/binding_constraint_management.py @@ -416,8 +416,8 @@ def constraint_model_adapter(constraint: Mapping[str, Any], version: int) -> Con "time_step": constraint.get("type", BindingConstraintFrequency.HOURLY), "operator": constraint.get("operator", BindingConstraintOperator.EQUAL), "comments": constraint.get("comments", ""), - "filter_year_by_year": constraint.get("filter_year_by_year", ""), - "filter_synthesis": constraint.get("filter_synthesis", ""), + "filter_year_by_year": constraint.get("filter_year_by_year") or constraint.get("filter-year-by-year"), + "filter_synthesis": constraint.get("filter_synthesis") or constraint.get("filter-synthesis"), "terms": constraint.get("terms", []), } @@ -473,10 +473,10 @@ def get_binding_constraint( # If a specific constraint ID is provided, we return that constraint if filters.bc_id: - return filtered_constraints.get(filters.bc_id) # type: ignore + return filtered_constraints.get(filters.bc_id) # type: ignore # Else we return all the matching constraints, based on the given filters - return list(filtered_constraints.values()) + return list(filtered_constraints.values()) def get_grouped_constraints(self, study: Study) -> Mapping[str, Sequence[ConstraintOutput]]: """