mirror of
https://github.com/sartography/protocol-builder-mock.git
synced 2025-02-11 07:06:52 +00:00
Merge pull request #30 from sartography/feature/limit_investigator_options
Feature/limit investigator options
This commit is contained in:
commit
b8b8dd00b0
@ -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':
|
||||
|
Loading…
x
Reference in New Issue
Block a user