Skip to content

Commit

Permalink
Merge pull request #164 from biocore/st_dh_issue_162
Browse files Browse the repository at this point in the history
St dh issue 162
  • Loading branch information
wasade committed May 19, 2020
2 parents f0ae452 + 6dae77a commit edb98da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions microsetta_private_api/example/client_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ def get_source(account_id, source_id):
if next_state != ALL_DONE:
return redirect(WORKFLOW_URL)

# Retrieve the source
do_return, source_output, _ = ApiRequest.get(
'/accounts/%s/sources/%s' %
(account_id, source_id)
)
if do_return:
return source_output

# Retrieve all samples from the source
do_return, samples_output, _ = ApiRequest.get(
'/accounts/%s/sources/%s/samples' % (account_id, source_id))
Expand Down Expand Up @@ -540,9 +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,
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 %}
{% 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 sample.ffq %}
{% if is_human and sample.ffq %}
Food Frequency Questionnaire<span class="fa fa-check"/>
{% else %}
{% 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 edb98da

Please sign in to comment.