Merge pull request #31 from sartography/dev

dev to testing
This commit is contained in:
Dan Funk 2020-08-17 16:40:15 -04:00 committed by GitHub
commit 134c4dbc42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -217,6 +217,16 @@ def edit_study(study_id):
@app.route('/investigator/<study_id>', methods=['GET', 'POST'])
def new_investigator(study_id):
form = InvestigatorForm(request.form)
# Remove options from form if unique investigator already exist, but AS_C and SI can happen many times.
investigators = db.session.query(Investigator).filter(Study.STUDYID == study_id).all()
choices = form.INVESTIGATORTYPE.choices
existing_types = [i.INVESTIGATORTYPE for i in investigators]
existing_types = list(filter(lambda a: a != "AS_C", existing_types))
existing_types = list(filter(lambda a: a != "SI", existing_types))
new_choices = [choice for choice in choices if choice[0] not in existing_types]
form.INVESTIGATORTYPE.choices = new_choices
action = BASE_HREF + "/investigator/" + study_id
title = "Add Investigator to Study " + study_id
if request.method == 'POST':