Skip to content

Commit 3e02db5

Browse files
committed
fix short name checks for regulation groups
1 parent 0122fa3 commit 3e02db5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

arho_feature_template/gui/dialogs/plan_feature_form.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ def _check_regulation_group_short_names(self) -> bool:
114114
if not short_name:
115115
continue
116116

117-
if short_name in self.existing_group_short_names:
117+
if (
118+
not (
119+
reg_group_widget.regulation_group.id_ and short_name == reg_group_widget.regulation_group.short_name
120+
)
121+
and short_name in self.existing_group_short_names
122+
):
118123
existing_names.add(short_name)
119124
if short_name in seen_names:
120125
duplicate_names.add(short_name)

arho_feature_template/gui/dialogs/plan_regulation_group_form.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ def _initalize_regulation_from_config(self, config: RegulationConfig, parent: QT
146146

147147
def _check_short_name(self) -> bool:
148148
short_name = self.short_name.text()
149-
if short_name and short_name in self.existing_group_short_names:
149+
150+
if not short_name:
151+
return True
152+
if (
153+
not (self.regulation_group.id_ and short_name == self.regulation_group.short_name)
154+
and short_name in self.existing_group_short_names
155+
):
150156
msg = f"Kaavamääräysryhmä lyhyellä nimellä '<b>{short_name}</b>' on jo olemassa."
151157
QMessageBox.critical(self, "Virhe", msg)
152158
return False

0 commit comments

Comments
 (0)