Skip to content

Commit

Permalink
removing ffq, adding unique id for ssa card
Browse files Browse the repository at this point in the history
  • Loading branch information
ayobi committed Sep 20, 2024
1 parent a826cd9 commit a7d3420
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
13 changes: 8 additions & 5 deletions microsetta_interface/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Source:
VIOSCREEN_ID = 10001
MYFOODREPO_ID = 10002
POLYPHENOL_FFQ_ID = 10003
SKIN_SCORING_APP_FFQ_ID = 10005
SKIN_SCORING_APP_ID = 10005
SPAIN_FFQ_ID = 10004

SYSTEM_MSG_DICTIONARY = {
Expand Down Expand Up @@ -399,7 +399,7 @@ class Source:
'est_minutes': '30',
'icon': 'survey_external.svg'
},
SKIN_SCORING_APP_FFQ_ID: {
SKIN_SCORING_APP_ID: {
'description': 'TBD',
'est_minutes': 'TBD',
'icon': 'survey_external.svg'
Expand Down Expand Up @@ -473,7 +473,7 @@ def _get_req_survey_templates_by_source_type(source_type):
def _get_opt_survey_templates_by_source_type(source_type):
if source_type == Source.SOURCE_TYPE_HUMAN:
return [3, 4, 5, 7, MYFOODREPO_ID, POLYPHENOL_FFQ_ID,
SPAIN_FFQ_ID, SKIN_SCORING_APP_FFQ_ID]
SPAIN_FFQ_ID, SKIN_SCORING_APP_ID]
elif source_type == Source.SOURCE_TYPE_ANIMAL:
return []
elif source_type == Source.SOURCE_TYPE_ENVIRONMENT:
Expand Down Expand Up @@ -1406,7 +1406,7 @@ def get_fill_source_survey(*,

# this is remote, so go to an external url, not our jinja2 template
return redirect(survey_output['survey_template_text']['url'])
elif survey_template_id == SKIN_SCORING_APP_FFQ_ID:
elif survey_template_id == SKIN_SCORING_APP_ID:
if need_reconsent:
return render_consent_page(
account_id, source_id, "data", reconsent=True
Expand Down Expand Up @@ -1864,7 +1864,10 @@ def get_source(*, account_id=None, source_id=None):
for answer in survey_answers:
template_id = answer['survey_template_id']
for template in local_surveys + remote_surveys:
if template['survey_template_id'] == template_id:
if template['survey_template_id'] == 10005:
template['survey_id'] = answer['survey_id']
template['answered'] = True
else:
template['answered'] = True

for template in local_surveys:
Expand Down
4 changes: 3 additions & 1 deletion microsetta_interface/templates/source.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@
{% endif %}
<div class="card card-survey-external">
<div class="row m-2 survey-info-row">
{% if detail.answered %}
{% if detail.survey_template_id == 10005 %}
<div class="col-8 card-survey-completed">{{ _('COMPLETED') }} <br> {{ _('Unique ID') }}: {{ detail.survey_id }}</div>
{% elif detail.answered %}
<div class="col-8 card-survey-completed">{{ _('COMPLETED') }}</div>
{% else %}
<div class="col-8 card-survey-new">{{ _('NEW') }}</div>
Expand Down
4 changes: 2 additions & 2 deletions microsetta_interface/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _fake_jwt(email, verified, uniqify=False):
MYFOODREPO_ID = 10002
POLYPHENOL_FFQ_ID = 10003
SPAIN_FFQ_ID = 10004
SKIN_SCORING_FFQ_ID = 10005
SKIN_SCORING_ID = 10005

BASIC_INFO_SIMPLE = {"112": "1970"}
BASIC_INFO_SIMPLE_ALT = {"112": "1983"}
Expand Down Expand Up @@ -574,7 +574,7 @@ def _complete_spain_ffq_survey(self, account_id, source_id):
f'take_survey?survey_template_id=10004')
return self.app.get(url), url

def _complete_skin_scoring_app_ffq_survey(self, account_id, source_id):
def _complete_skin_scoring_app_survey(self, account_id, source_id):
url = (f'/accounts/{account_id}/sources/{source_id}/'
f'take_survey?survey_template_id=10005')
return self.app.get(url), url
Expand Down

0 comments on commit a7d3420

Please sign in to comment.