Skip to content

Commit

Permalink
fix(bc): wrong key access for filter_year_by_year and `filter_synth…
Browse files Browse the repository at this point in the history
…esis`
  • Loading branch information
hdinia committed Mar 28, 2024
1 parent def92ca commit 4f4ddc8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions antarest/study/business/binding_constraint_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", []),
}

Expand Down Expand Up @@ -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]]:
"""
Expand Down

0 comments on commit 4f4ddc8

Please sign in to comment.