From a3c082510f9b310babb5dca5574755c1f21487aa Mon Sep 17 00:00:00 2001 From: ayobi Date: Wed, 18 Sep 2024 23:08:26 -0300 Subject: [PATCH 01/10] init commit --- microsetta_interface/implementation.py | 17 ++++++++++++++++- microsetta_interface/tests/test_integration.py | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index 283b6755..5adbdddf 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -124,6 +124,7 @@ class Source: VIOSCREEN_ID = 10001 MYFOODREPO_ID = 10002 POLYPHENOL_FFQ_ID = 10003 +SKIN_SCORING_APP_FFQ_ID = 10005 SPAIN_FFQ_ID = 10004 SYSTEM_MSG_DICTIONARY = { @@ -398,6 +399,11 @@ class Source: 'est_minutes': '30', 'icon': 'survey_external.svg' }, + SKIN_SCORING_APP_FFQ_ID: { + 'description': 'TBD', + 'est_minutes': 'TBD', + 'icon': 'survey_external.svg' + }, } LOCAL_SURVEY_SEQUENCE = [ BASIC_INFO_ID, @@ -466,7 +472,8 @@ 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] + return [3, 4, 5, 7, MYFOODREPO_ID, POLYPHENOL_FFQ_ID, + SPAIN_FFQ_ID, SKIN_SCORING_APP_FFQ_ID] elif source_type == Source.SOURCE_TYPE_ANIMAL: return [] elif source_type == Source.SOURCE_TYPE_ENVIRONMENT: @@ -1366,6 +1373,14 @@ def get_fill_source_survey(*, account_id, source_id, "data", reconsent=True ) + # 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: + if need_reconsent: + return render_consent_page( + account_id, source_id, "data", reconsent=True + ) + # this is remote, so go to an external url, not our jinja2 template return redirect(survey_output['survey_template_text']['url']) else: diff --git a/microsetta_interface/tests/test_integration.py b/microsetta_interface/tests/test_integration.py index ddc4a4e2..f4e8ac90 100644 --- a/microsetta_interface/tests/test_integration.py +++ b/microsetta_interface/tests/test_integration.py @@ -106,6 +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 BASIC_INFO_SIMPLE = {"112": "1970"} BASIC_INFO_SIMPLE_ALT = {"112": "1983"} @@ -573,6 +574,11 @@ 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): + url = (f'/accounts/{account_id}/sources/{source_id}/' + f'take_survey?survey_template_id=10005') + return self.app.get(url), url + def test_new_user_to_source_listing(self): resp, url, user_jwt = self._new_to_create() account_id, _, _ = self._ids_from_url(url) From a7d3420f9b63f12a38a5053ed4532753d549f2ca Mon Sep 17 00:00:00 2001 From: ayobi Date: Thu, 19 Sep 2024 23:00:44 -0300 Subject: [PATCH 02/10] removing ffq, adding unique id for ssa card --- microsetta_interface/implementation.py | 13 ++++++++----- microsetta_interface/templates/source.jinja2 | 4 +++- microsetta_interface/tests/test_integration.py | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index 2f31ee95..0b92a40c 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -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 = { @@ -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' @@ -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: @@ -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 @@ -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: diff --git a/microsetta_interface/templates/source.jinja2 b/microsetta_interface/templates/source.jinja2 index eafd0f76..7e5bdf8b 100644 --- a/microsetta_interface/templates/source.jinja2 +++ b/microsetta_interface/templates/source.jinja2 @@ -128,7 +128,9 @@ {% endif %}
- {% if detail.answered %} + {% if detail.survey_template_id == 10005 %} +
{{ _('COMPLETED') }}
{{ _('Unique ID') }}: {{ detail.survey_id }}
+ {% elif detail.answered %}
{{ _('COMPLETED') }}
{% else %}
{{ _('NEW') }}
diff --git a/microsetta_interface/tests/test_integration.py b/microsetta_interface/tests/test_integration.py index c9c93388..9b63197c 100644 --- a/microsetta_interface/tests/test_integration.py +++ b/microsetta_interface/tests/test_integration.py @@ -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"} @@ -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 From ed1a35c611795fa22f9af9a9dbe9ac678ef3374c Mon Sep 17 00:00:00 2001 From: ayobi Date: Fri, 20 Sep 2024 21:12:02 -0300 Subject: [PATCH 03/10] show unique id/clickable after completed for project 10005 --- microsetta_interface/templates/source.jinja2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/microsetta_interface/templates/source.jinja2 b/microsetta_interface/templates/source.jinja2 index 7e5bdf8b..e31b086a 100644 --- a/microsetta_interface/templates/source.jinja2 +++ b/microsetta_interface/templates/source.jinja2 @@ -123,13 +123,13 @@
{% for detail in remote_surveys %} From 331e45c83bacb679f1cd4b622259c82aa78d871b Mon Sep 17 00:00:00 2001 From: ayobi Date: Tue, 24 Sep 2024 14:53:01 -0300 Subject: [PATCH 04/10] change for constants --- microsetta_interface/implementation.py | 5 +++-- microsetta_interface/templates/source.jinja2 | 8 ++++---- microsetta_interface/tests/test_integration.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index 0b92a40c..c2a1bbea 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -1864,7 +1864,7 @@ 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'] == 10005: + if template['survey_template_id'] == SKIN_SCORING_APP_ID: template['survey_id'] = answer['survey_id'] template['answered'] = True else: @@ -1928,7 +1928,8 @@ def get_source(*, account_id=None, source_id=None): source_name=source_output['source_name'], profile_has_samples=profile_has_samples, need_reconsent=need_reconsent, - show_update_age=show_update_age + show_update_age=show_update_age, + SKIN_SCORING_APP_ID=SKIN_SCORING_APP_ID ) diff --git a/microsetta_interface/templates/source.jinja2 b/microsetta_interface/templates/source.jinja2 index e31b086a..691dad86 100644 --- a/microsetta_interface/templates/source.jinja2 +++ b/microsetta_interface/templates/source.jinja2 @@ -123,12 +123,12 @@
{% for detail in remote_surveys %} diff --git a/microsetta_interface/tests/test_integration.py b/microsetta_interface/tests/test_integration.py index 9b63197c..942b96aa 100644 --- a/microsetta_interface/tests/test_integration.py +++ b/microsetta_interface/tests/test_integration.py @@ -106,7 +106,7 @@ def _fake_jwt(email, verified, uniqify=False): MYFOODREPO_ID = 10002 POLYPHENOL_FFQ_ID = 10003 SPAIN_FFQ_ID = 10004 -SKIN_SCORING_ID = 10005 +SKIN_SCORING_APP_ID = 10005 BASIC_INFO_SIMPLE = {"112": "1970"} BASIC_INFO_SIMPLE_ALT = {"112": "1983"} @@ -576,7 +576,7 @@ def _complete_spain_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') + f'take_survey?survey_template_id={SKIN_SCORING_APP_ID}') return self.app.get(url), url def test_new_user_to_source_listing(self): From 923ab59c5152b93b329e75c1ef21a337a1540de9 Mon Sep 17 00:00:00 2001 From: lmerchant Date: Fri, 10 Jan 2025 17:17:12 -0800 Subject: [PATCH 05/10] style: add flex grid CSS to outer div of barcode buttons to enable wrapping Make the div surrounding all the barcode buttons on the "My Kits" web page a flex grid. Now all the buttons wrap and are responsive. Fixes Issue #323 --- microsetta_interface/templates/kits.jinja2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/microsetta_interface/templates/kits.jinja2 b/microsetta_interface/templates/kits.jinja2 index 1f776999..e60e4835 100644 --- a/microsetta_interface/templates/kits.jinja2 +++ b/microsetta_interface/templates/kits.jinja2 @@ -23,6 +23,11 @@ .tooltip.bs-tooltip-top .tooltip-arrow::before { border-top-color: #0000ff !important; } + .new_kit_sample_container { + display: flex; + flex-wrap: wrap; + gap: 10px; + } {% endblock %} @@ -217,6 +247,7 @@
+