Skip to content

Commit

Permalink
Merge pull request #247 from biocore/csymons_spain_vioscreen_bypass_fix
Browse files Browse the repository at this point in the history
Spain Vioscreen Bypass
  • Loading branch information
cassidysymons authored Oct 13, 2022
2 parents 3996a01 + a538f6b commit c3fe70b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion microsetta_interface/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,19 @@ def post_update_sample(*, account_id=None, source_id=None, sample_id=None):
if answer['survey_template_id'] == VIOSCREEN_ID:
has_ffq = True

if not has_ffq:
# Hack to determine if user's country is Spain OR locale is es_ES
# If either condition is true, bypass the Vioscreen option
spain_user = False

has_error, account, _ = ApiRequest.get('/accounts/%s' % account_id)
if has_error:
return account

country = account[ACCT_ADDR_KEY][ACCT_ADDR_COUNTRY_CODE_KEY]
if country == "ES" or session_locale() == "es_ES":
spain_user = True

if not has_ffq and spain_user is False:
url = '/accounts/%s/sources/%s/samples/%s/after_edit_questionnaire'
return redirect(url % (account_id, source_id, sample_id))
return _refresh_state_and_route_to_sink(account_id, source_id)
Expand Down

0 comments on commit c3fe70b

Please sign in to comment.