From 9ab428751798ed07f6f774950dcba2697d1f3d9b Mon Sep 17 00:00:00 2001 From: alesan99 Date: Mon, 2 Mar 2026 16:30:28 -0600 Subject: [PATCH 1/2] WIP Fix database setup loading page appearing if using config tool when logging in --- specifyweb/backend/setup_tool/api.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/specifyweb/backend/setup_tool/api.py b/specifyweb/backend/setup_tool/api.py index 05ad45c3b17..ae63ce2f911 100644 --- a/specifyweb/backend/setup_tool/api.py +++ b/specifyweb/backend/setup_tool/api.py @@ -48,7 +48,9 @@ def get_setup_progress() -> dict: """Returns a dictionary of the status of the database setup.""" # Check if setup is currently in progress active_setup_task, busy = get_active_setup_task() - busy = busy or is_config_task_running() + config_tasks_running = is_config_task_running() + + busy = busy or (config_tasks_running and not is_config_tool_running()) completed_resources = None last_error = None @@ -84,6 +86,14 @@ def get_setup_resource_progress() -> dict: "specifyUser": models.Specifyuser.objects.exists(), } +def is_config_tool_running() -> bool: + """Returns true if the System Configuration Tool is responsible for the setup tasks running + Guessed based on the existence of >1 divisions/disicplines/collections existing.""" + return models.Division.objects.count() > 1 or \ + models.Discipline.objects.count() > 1 or \ + models.Collection.objects.count() > 1 or \ + models.Specifyuser.objects.count() > 1 + def _guided_setup_condition(request) -> bool: from specifyweb.specify.models import Specifyuser if Specifyuser.objects.exists(): @@ -473,11 +483,6 @@ def create_tree(name: str, data: dict) -> dict: setattr(discipline, tree_field_name, treedef.id) discipline.save() - # Optionally preload tree - # NOTE: You probably do not want to do this during the initial setup, as there are still resources missing. - # if preload_tree: - # if discipline is not None: - # start_preload_default_tree(name, discipline.id, None, treedef.id, None, preload_tree_file) return {'treedef_id': treedef.id} except Exception as e: raise SetupError(e) From fe170970127c6318061b1eb28de69d0a5f4a7706 Mon Sep 17 00:00:00 2001 From: alesan99 Date: Mon, 2 Mar 2026 16:33:18 -0600 Subject: [PATCH 2/2] Cleanup --- specifyweb/backend/setup_tool/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/backend/setup_tool/api.py b/specifyweb/backend/setup_tool/api.py index ae63ce2f911..ff1ea07035d 100644 --- a/specifyweb/backend/setup_tool/api.py +++ b/specifyweb/backend/setup_tool/api.py @@ -88,7 +88,7 @@ def get_setup_resource_progress() -> dict: def is_config_tool_running() -> bool: """Returns true if the System Configuration Tool is responsible for the setup tasks running - Guessed based on the existence of >1 divisions/disicplines/collections existing.""" + Guessed based on the existence of more than one divisions/disicplines/collections.""" return models.Division.objects.count() > 1 or \ models.Discipline.objects.count() > 1 or \ models.Collection.objects.count() > 1 or \