From a70058ffc672af24146347b63c5e69a201286505 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Tue, 5 Nov 2024 11:24:32 -0500 Subject: [PATCH] Revert hascustomalias to False when alias regenerated --- arches/app/models/graph.py | 1 + tests/models/node_tests.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arches/app/models/graph.py b/arches/app/models/graph.py index 903e18866d..6bc3e78aa0 100644 --- a/arches/app/models/graph.py +++ b/arches/app/models/graph.py @@ -2117,6 +2117,7 @@ def create_node_alias(self, node): n.alias for n in self.nodes.values() if node.alias != n.alias ] node.alias = self.make_name_unique(row[0], aliases, "_n") + node.hascustomalias = False return node.alias def validate(self): diff --git a/tests/models/node_tests.py b/tests/models/node_tests.py index f353ab6352..b5d07900ec 100644 --- a/tests/models/node_tests.py +++ b/tests/models/node_tests.py @@ -19,8 +19,9 @@ def test_missing_alias_supplied(self): def test_empty_custom_alias_regenerated(self): """One dubiously empty alias per graph is currently allowed at the database level. Ensure it is regenerated via the application.""" - new_node = Node(graph_id=self.graph.pk, name="Test node") - new_node.hascustomalias = True - new_node.alias = "" + new_node = Node( + graph_id=self.graph.pk, name="Test node", alias="", hascustomalias=True + ) new_node.clean() self.assertEqual(new_node.alias, "test_node") + self.assertIs(new_node.hascustomalias, False)