From a5b36850d60af19d527e82607251f7a915bc4f84 Mon Sep 17 00:00:00 2001 From: Paul Bui-Quang Date: Wed, 29 Sep 2021 11:15:15 +0200 Subject: [PATCH] Fix remove area command Signed-off-by: Paul Bui-Quang --- .../storage/variantstudy/model/command/remove_area.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/antarest/study/storage/variantstudy/model/command/remove_area.py b/antarest/study/storage/variantstudy/model/command/remove_area.py index ae1ad52c12..82d9a9d704 100644 --- a/antarest/study/storage/variantstudy/model/command/remove_area.py +++ b/antarest/study/storage/variantstudy/model/command/remove_area.py @@ -132,8 +132,12 @@ def _apply(self, study_data: FileStudy) -> CommandOutput: ) del study_data.config.areas[self.id] - for area_name in study_data.config.areas.keys(): - study_data.tree.delete(["input", "links", area_name, self.id]) + for area_name, area in study_data.config.areas.items(): + for link in area.links.keys(): + if link == self.id: + study_data.tree.delete( + ["input", "links", area_name, self.id] + ) new_area_data: JSON = { "input": {