Skip to content

Commit

Permalink
Moved source_type check from jinja to python
Browse files Browse the repository at this point in the history
  • Loading branch information
dhakim87 committed May 19, 2020
1 parent 3f3ca9a commit 6dae77a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion microsetta_private_api/example/client_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,11 @@ def get_source(account_id, source_id):
if answer['survey_template_id'] == VIOSCREEN_ID:
sample['ffq'] = True

is_human = source_output['source_type'] == Source.SOURCE_TYPE_HUMAN
return render_template('source.jinja2',
acct_id=account_id,
source_id=source_id,
source_type=source_output['source_type'],
is_human=is_human,
samples=samples_output,
surveys=per_source,
vioscreen_id=VIOSCREEN_ID)
Expand Down
6 changes: 3 additions & 3 deletions microsetta_private_api/templates/source.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<div class="container">
{% if samples|length > 0 %}
Samples:
{% if samples|length > 1 and source_type == "human" %}
{% if samples|length > 1 and is_human %}
<p><i>If collecting all samples on the same day, please only complete a single Food Frequency Questionnaire.</i></p>
{% endif %}
<div class="list-group">
Expand All @@ -98,9 +98,9 @@
{{sample.sample_site |e}}
</div>
<div class="col-sm">
{% if source_type == "human" and sample.ffq %}
{% if is_human and sample.ffq %}
Food Frequency Questionnaire<span class="fa fa-check"/>
{% elif source_type == "human" %}
{% elif is_human %}
<a href="/accounts/{{acct_id}}/sources/{{source_id}}/samples/{{sample.sample_id}}/survey_templates/{{vioscreen_id}}">Food Frequency Questionnaire</a><span class="fa fa-unchecked"/>
{% endif %}
</div>
Expand Down

0 comments on commit 6dae77a

Please sign in to comment.