Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix update link code
Browse files Browse the repository at this point in the history
MartinBelthle committed Jan 21, 2025
1 parent cacdd62 commit c6abd00
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@
from typing_extensions import override

from antarest.core.utils.fastapi_sqlalchemy import db
from antarest.study.business.model.link_model import LinkInternal, LinkTsGeneration
from antarest.study.model import LinksParametersTsGeneration
from antarest.study.business.model.link_model import Area, LinkInternal, LinkTsGeneration
from antarest.study.model import STUDY_VERSION_8_2, LinksParametersTsGeneration
from antarest.study.storage.rawstudy.model.filesystem.config.model import FileStudyTreeConfig
from antarest.study.storage.rawstudy.model.filesystem.factory import FileStudy
from antarest.study.storage.variantstudy.model.command.common import CommandName, CommandOutput
@@ -55,7 +55,10 @@ def _apply(self, study_data: FileStudy, listener: t.Optional[ICommandListener] =
internal_link = LinkInternal.model_validate(self.parameters)

# Updates ini properties
new_ini_properties = internal_link.model_dump(include=self.parameters, by_alias=True)
to_exclude = set(Area.model_fields.keys() & LinkTsGeneration.model_fields.keys())
if version < STUDY_VERSION_8_2:
to_exclude.update("filter-synthesis", "filter-year-by-year")
new_ini_properties = internal_link.model_dump(by_alias=True, exclude=to_exclude)
properties.update(new_ini_properties)
study_data.tree.save(properties, ["input", "links", self.area1, "properties", self.area2])

0 comments on commit c6abd00

Please sign in to comment.