Just a little prettier.

This commit is contained in:
Dan 2021-05-14 14:44:48 -04:00
parent 2770125025
commit 295008304a
2 changed files with 7 additions and 6 deletions

View File

@ -140,15 +140,16 @@ from pb.models import Study, RequiredDocument, Investigator, StudySchema, Requir
from pb.ldap.ldap_service import LdapService
def render_study_template(studies):
def render_study_template(studies, uva_id):
table = StudyTable(studies)
users = []
[users.append(study.NETBADGEID) for study in studies if study.NETBADGEID not in users]
[users.append(study.NETBADGEID) for study in db.session.query(Study).all() if study.NETBADGEID not in users]
return render_template(
'index.html',
table=table,
base_href=BASE_HREF,
users=users
users=users,
selected_user=uva_id
)
@ -218,7 +219,7 @@ def user_studies(uva_id):
studies = db.session.query(Study).filter(Study.NETBADGEID == uva_id).order_by(Study.DATE_MODIFIED.desc()).all()
current_user = get_current_user(request)
update_selected_user(current_user, uva_id)
return render_study_template(studies)
return render_study_template(studies, uva_id)
@app.route('/new_study', methods=['GET', 'POST'])

View File

@ -20,10 +20,10 @@
<label>Only Show Studies for: </label>
<select name="uva_id" id="uva_id" onchange="selectStudies()">
<option value="">Select User</option>
<option value="all">All Users</option>
<option value="all" {% if selected_user=='all' %}selected{% endif %}>All Users</option>
{% if users %}
{% for user in users %}
<option value="{{ user }}">{{ user }}</option>
<option value="{{ user }}" {% if selected_user==user %}selected{% endif %}>{{ user }}</option>
{% endfor %}
{% endif %}
</select>