Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions specifyweb/backend/setup_tool/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 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 \
models.Specifyuser.objects.count() > 1

def _guided_setup_condition(request) -> bool:
from specifyweb.specify.models import Specifyuser
if Specifyuser.objects.exists():
Expand Down Expand Up @@ -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)
Expand Down