From dde565e0ae7db5003453c28d1a3902be7d224440 Mon Sep 17 00:00:00 2001 From: Cannon Lock Date: Fri, 7 Jun 2024 11:33:15 -0500 Subject: [PATCH] Fix Project form - If no shortname don't auto complete project name - Use the entire institutions api to populate the insitution field --- src/app.py | 3 +-- src/templates/generate_project_yaml.html.j2 | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app.py b/src/app.py index 75e01bb40..30e7d4b25 100755 --- a/src/app.py +++ b/src/app.py @@ -867,10 +867,9 @@ def generate_project_yaml(): institution_short_names = {x[1]: x[0] for x in global_data.get_mappings().project_institution.items()} institutions = [] for institution in institution_api_data: - institutions.append((institution['id'], institution['name'], institution_short_names.get(institution['name'], ""))) + institutions.append((institution_short_names.get(institution['name'], ""), institution['name'])) def render_form(**kwargs): - institutions = list(global_data.get_mappings().project_institution.items()) session.pop("form_data", None) return render_template( diff --git a/src/templates/generate_project_yaml.html.j2 b/src/templates/generate_project_yaml.html.j2 index 4a63a3f9a..fb9926c80 100644 --- a/src/templates/generate_project_yaml.html.j2 +++ b/src/templates/generate_project_yaml.html.j2 @@ -152,7 +152,7 @@ Project YAML Generator function updateProjectName(){ project_name_node.readOnly = false - if(!(pi_institution_node.value in institutions) || !pi_last_name_node.value){ return } + if(!(pi_institution_node.value in institutions) || !institutions[pi_institution_node.value] || !pi_last_name_node.value){ return } let pi_institution = institutions[pi_institution_node.value] let pi_last_name = pi_last_name_node.value