From 77ea4a6d2972e63c9f9a23c9bdb71507ad8f97fd Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Tue, 30 Jul 2024 11:34:52 +0200 Subject: [PATCH 1/3] Add skip result and skip threshold --- home/api.py | 8 +++ home/export_assessments.py | 8 +++ home/import_assessments.py | 14 +++++ ...sessment_skip_high_result_page_and_more.py | 34 ++++++++++++ home/models.py | 14 +++++ .../assessment_less_simple.csv | 12 ++--- .../import-export-data/assessment_simple.csv | 8 +-- .../import-export-data/bulk_assessments.csv | 52 +++++++++--------- .../comma_separated_answers.csv | 4 +- .../multiple_assessments.csv | 22 ++++---- .../results_assessments.csv | 54 +++++++++---------- home/tests/test_api.py | 41 ++++++++++++++ home/tests/test_assessment_import_export.py | 12 +++++ home/tests/test_serializers.py | 14 +++++ home/wagtail_hooks.py | 2 + 15 files changed, 223 insertions(+), 76 deletions(-) create mode 100644 home/migrations/0079_assessment_skip_high_result_page_and_more.py diff --git a/home/api.py b/home/api.py index 30d505db..a59c634c 100644 --- a/home/api.py +++ b/home/api.py @@ -231,6 +231,8 @@ class AssessmentViewSet(BaseAPIViewSet): "medium_result_page", "medium_inflection", "low_result_page", + "skip_threshold", + "skip_high_result_page", "generic_error", "questions", ] @@ -246,6 +248,8 @@ class AssessmentViewSet(BaseAPIViewSet): "medium_inflection", "low_result_page", "low_inflection", + "skip_threshold", + "skip_high_result_page", "generic_error", "questions", ] @@ -274,6 +278,10 @@ def get_queryset(self): assessment.medium_result_page = latest_revision.medium_result_page assessment.medium_inflection = latest_revision.medium_inflection assessment.low_result_page = latest_revision.low_result_page + assessment.skip_threshold = latest_revision.skip_threshold + assessment.skip_high_result_page = ( + latest_revision.skip_high_result_page + ) assessment.generic_error = latest_revision.generic_error assessment.questions = latest_revision.questions diff --git a/home/export_assessments.py b/home/export_assessments.py index 72ebb294..8bc17292 100644 --- a/home/export_assessments.py +++ b/home/export_assessments.py @@ -30,6 +30,8 @@ class ExportRow: medium_result_page: str | None medium_inflection: str | None low_result_page: str | None + skip_threshold: str | None + skip_high_result_page: str | None generic_error: str question: str explainer: str @@ -83,6 +85,10 @@ def perform_export(self) -> Iterable[ExportRow]: medium_result_page=getattr(item.medium_result_page, "slug", None), medium_inflection=getattr(item, "medium_inflection", None), low_result_page=getattr(item.low_result_page, "slug", None), + skip_threshold=getattr(item, "skip_threshold", 0.0), + skip_high_result_page=getattr( + item.skip_high_result_page, "slug", None + ), generic_error=item.generic_error, question=question.value["question"], explainer=question.value["explainer"], @@ -161,6 +167,8 @@ def _set_xlsx_styles(wb: Workbook, sheet: Worksheet) -> None: "medium_result_page": 120, "medium_inflection": 110, "low_result_page": 110, + "skip_threshold": 110, + "skip_high_result_page": 110, "generic_error": 370, "question": 370, "explainer": 370, diff --git a/home/import_assessments.py b/home/import_assessments.py index ec83c336..7e73ef64 100644 --- a/home/import_assessments.py +++ b/home/import_assessments.py @@ -156,6 +156,7 @@ def create_shadow_assessment_from_row( high_result_page=row.high_result_page, medium_result_page=row.medium_result_page, low_result_page=row.low_result_page, + skip_high_result_page=row.skip_high_result_page, high_inflection=( None if row.high_inflection == "" else float(row.high_inflection) ), @@ -164,6 +165,9 @@ def create_shadow_assessment_from_row( if row.medium_inflection == "" else float(row.medium_inflection) ), + skip_threshold=( + 0.0 if row.skip_threshold == "" else float(row.skip_threshold) + ), generic_error=row.generic_error, tags=row.tags, ) @@ -219,6 +223,8 @@ class ShadowAssessment: low_result_page: str high_inflection: float | None medium_inflection: float | None + skip_threshold: float + skip_high_result_page: str generic_error: str questions: list[ShadowQuestionBlock] = field(default_factory=list) tags: list[str] = field(default_factory=list) @@ -259,6 +265,12 @@ def add_field_values_to_assessment(self, assessment: Assessment) -> None: if self.low_result_page == "" else get_content_page_id_from_slug(self.low_result_page) ) + assessment.skip_high_result_page_id = ( + None + if self.skip_high_result_page == "" + else get_content_page_id_from_slug(self.skip_high_result_page) + ) + assessment.skip_threshold = self.skip_threshold assessment.generic_error = self.generic_error assessment.questions = self.questions_as_streamfield @@ -316,6 +328,8 @@ class AssessmentRow: medium_result_page: str = "" medium_inflection: str = "" low_result_page: str = "" + skip_threshold: str = "" + skip_high_result_page: str = "" generic_error: str = "" question: str = "" explainer: str = "" diff --git a/home/migrations/0079_assessment_skip_high_result_page_and_more.py b/home/migrations/0079_assessment_skip_high_result_page_and_more.py new file mode 100644 index 00000000..243a93cd --- /dev/null +++ b/home/migrations/0079_assessment_skip_high_result_page_and_more.py @@ -0,0 +1,34 @@ +# Generated by Django 4.2.11 on 2024-07-29 13:34 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("home", "0078_alter_assessment_high_inflection_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="assessment", + name="skip_high_result_page", + field=models.ForeignKey( + blank=True, + help_text="The page to show a user if they skip a question", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="assessment_high_skip", + to="home.contentpage", + ), + ), + migrations.AddField( + model_name="assessment", + name="skip_threshold", + field=models.FloatField( + default=0, + help_text="If a user skips equal to or greater than this many questions they will be presented with the skip page", + ), + ), + ] diff --git a/home/models.py b/home/models.py index 35e2ac3f..e05bcbd1 100644 --- a/home/models.py +++ b/home/models.py @@ -1425,6 +1425,18 @@ class Assessment(DraftStateMixin, RevisionMixin, index.Indexed, ClusterableModel blank=True, null=True, ) + skip_threshold = models.FloatField( + help_text="If a user skips equal to or greater than this many questions they will be presented with the skip page", + default=0, + ) + skip_high_result_page = models.ForeignKey( + ContentPage, + related_name="assessment_high_skip", + on_delete=models.CASCADE, + help_text="The page to show a user if they skip a question", + blank=True, + null=True, + ) generic_error = models.TextField( help_text="If no error is specified for a question, then this is used as the " "fallback" @@ -1464,6 +1476,8 @@ class Assessment(DraftStateMixin, RevisionMixin, index.Indexed, ClusterableModel APIField("medium_result_page", serializer=ContentPageSerializer()), APIField("medium_inflection"), APIField("low_result_page", serializer=ContentPageSerializer()), + APIField("skip_threshold"), + APIField("skip_high_result_page", serializer=ContentPageSerializer()), APIField("generic_error"), APIField("questions"), ] diff --git a/home/tests/import-export-data/assessment_less_simple.csv b/home/tests/import-export-data/assessment_less_simple.csv index 4f94b38f..1661c5a1 100644 --- a/home/tests/import-export-data/assessment_less_simple.csv +++ b/home/tests/import-export-data/assessment_less_simple.csv @@ -1,6 +1,6 @@ -title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know if you have been vaccinated for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know your temperature for a proper risk assessment. A very high temperature could suggest an infection is present.,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" -Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, -Weather Trivia,integer_question,weather-trivia,weather-trivia,v1.0,en,,,,,,"Sorry, we didn't quite get that.",What's the coldest weather you're experienced?,We need to know some things,Your reply should be between {min} and {max},20,-70,,, +title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,skip_threshold,skip_high_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know if you have been vaccinated for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know your temperature for a proper risk assessment. A very high temperature could suggest an infection is present.,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" +Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, +Weather Trivia,integer_question,weather-trivia,weather-trivia,v1.0,en,,,,,,2.0,skip-score,"Sorry, we didn't quite get that.",What's the coldest weather you're experienced?,We need to know some things,Your reply should be between {min} and {max},20,-70,,, diff --git a/home/tests/import-export-data/assessment_simple.csv b/home/tests/import-export-data/assessment_simple.csv index 5fcbe3d3..54db1061 100644 --- a/home/tests/import-export-data/assessment_simple.csv +++ b/home/tests/import-export-data/assessment_simple.csv @@ -1,4 +1,4 @@ -title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids -Health Assessment Simple,categorical_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" -Health Assessment Simple,age_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't under stand.,,,,, -Health Assessment Simple,multiselect_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" +title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,skip_threshold,skip_high_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids +Health Assessment Simple,categorical_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" +Health Assessment Simple,age_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't under stand.,,,,, +Health Assessment Simple,multiselect_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know your blood pressure for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" diff --git a/home/tests/import-export-data/bulk_assessments.csv b/home/tests/import-export-data/bulk_assessments.csv index 5e45cf85..8f12a9d9 100644 --- a/home/tests/import-export-data/bulk_assessments.csv +++ b/home/tests/import-export-data/bulk_assessments.csv @@ -1,26 +1,26 @@ -title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids -Health Assessment Simple,categorical_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" -Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" -Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" -Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" -Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,Just a generic error,Who invented the light bulb?,We need to know this for a proper risk assessment,We didn't quite get that,,,"Thomas Edison,Nikola Tesla,Albert Einstein","2.0,2.0,0.0","test-1,test-2,test-3" -Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,Just a generic error,Some planes can fly faster than the speed of light?,We need to know this for a proper risk assessment,We didn't quite get that,,,"True,False","0.0,2.0","test-1,test-2" -Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,Just a generic error,In what century was the mechanical clock invented?,We need to know this for a proper risk assessment,This is an error message,,,"13th century,16th century,18th century,14th century","0.0,0.0,0.0,2.0","test-1,test-2,test-3,test-4" -Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" -Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" -Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" -Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,This is a generic error,How many square feet is the average adult human’s skin?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"19 feet,21 feet,15 feet","2.0,0.0,0.0","test-1,test-2,test-3" -Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,This is a generic error,What type of blood cells fight infections and diseases?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"White blood cells,Red blood cells,Stem cells","2.0,0.0,0.0","test-1,test-2,test-3" -Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,This is a generic error,What does cartilage link?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Joints and bones,Digestive system","2.0,0.0","test-1,test-2" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,Aureolin is a shade of what color?,We need to know this for a proper risk assessment,Sorry we don't understand,,,"Pink,Yellow,Blue","0.0,1.0,0.0","test-1,test-2,test-3" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,How many ghosts chase Pac-Man at the start of each game?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"2,4.0,3","0.0,2.0,0.0","test-1,test-2,test-3" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,What Renaissance artist is buried in Rome's Pantheon?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Raphael,Angelo,Rijkaard","2.0,0.0,0.0","test-1,test-2,test-3" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,What game studio makes the Red Dead Redemption series?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Rockstar,Capcom,Konami","1.0,0.0,0.0","test-1,test-2,test-3" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the first question,We need to know this for a proper risk assessment,Please retry,,,"A,B","4.0,1.0","test-1,test-2" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the second question,We need to know this for a proper risk assessment,We did not quite get that,,,"A,B,C","1.0,3.0,4.0","test-1,test-2,test-3" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the third question,We need to know this for a proper risk assessment,Sorry we did not quite get that,,,"A,B,C","2.0,1.0,2.0","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know this for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know this for a proper risk assessment,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" -Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, -Weather Trivia,integer_question,weather-trivia,weather-trivia,v1.0,en,,,,,,"Sorry, we didn't quite get that.",What's the coldest weather you're experienced?,We need to know some things,Your reply should be between {min} and {max},20,-70,,, +title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,skip_threshold,skip_high_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids +Health Assessment Simple,categorical_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" +Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" +Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" +Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" +Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,2.0,skip-score,Just a generic error,Who invented the light bulb?,We need to know this for a proper risk assessment,We didn't quite get that,,,"Thomas Edison,Nikola Tesla,Albert Einstein","2.0,2.0,0.0","test-1,test-2,test-3" +Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,2.0,skip-score,Just a generic error,Some planes can fly faster than the speed of light?,We need to know this for a proper risk assessment,We didn't quite get that,,,"True,False","0.0,2.0","test-1,test-2" +Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,2.0,skip-score,Just a generic error,In what century was the mechanical clock invented?,We need to know this for a proper risk assessment,This is an error message,,,"13th century,16th century,18th century,14th century","0.0,0.0,0.0,2.0","test-1,test-2,test-3,test-4" +Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" +Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" +Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" +Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How many square feet is the average adult human’s skin?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"19 feet,21 feet,15 feet","2.0,0.0,0.0","test-1,test-2,test-3" +Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What type of blood cells fight infections and diseases?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"White blood cells,Red blood cells,Stem cells","2.0,0.0,0.0","test-1,test-2,test-3" +Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What does cartilage link?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Joints and bones,Digestive system","2.0,0.0","test-1,test-2" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,Aureolin is a shade of what color?,We need to know this for a proper risk assessment,Sorry we don't understand,,,"Pink,Yellow,Blue","0.0,1.0,0.0","test-1,test-2,test-3" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What Renaissance artist is buried in Rome's Pantheon?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Raphael,Angelo,Rijkaard","2.0,0.0,0.0","test-1,test-2,test-3" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How many ghosts chase Pac-Man at the start of each game?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"2,4.0,3","0.0,2.0,0.0","test-1,test-2,test-3" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What game studio makes the Red Dead Redemption series?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Rockstar,Capcom,Konami","1.0,0.0,0.0","test-1,test-2,test-3" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the first question,We need to know this for a proper risk assessment,Please retry,,,"A,B","4.0,1.0","test-1,test-2" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the second question,We need to know this for a proper risk assessment,We did not quite get that,,,"A,B,C","1.0,3.0,4.0","test-1,test-2,test-3" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the third question,We need to know this for a proper risk assessment,Sorry we did not quite get that,,,"A,B,C","2.0,1.0,2.0","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know this for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know this for a proper risk assessment,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" +Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, +Weather Trivia,integer_question,weather-trivia,weather-trivia,v1.0,en,,,,,,0.0,,"Sorry, we didn't quite get that.",What's the coldest weather you're experienced?,We need to know some things,Your reply should be between {min} and {max},20,-70,,, diff --git a/home/tests/import-export-data/comma_separated_answers.csv b/home/tests/import-export-data/comma_separated_answers.csv index 9d2e74db..453f3ca6 100644 --- a/home/tests/import-export-data/comma_separated_answers.csv +++ b/home/tests/import-export-data/comma_separated_answers.csv @@ -1,2 +1,2 @@ -title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids -Comma Separated Answers,categorical_question,comma separated,comma-separated-answers,v1.0,en,high-inflection,3.0,medium-score,2.0,low-score,Generic error,Please choose your comma separated answer,We need to know this for a proper risk assessment,[],,,"""This, is, the, first"",""This, is, the, second""","3.0,2.0","test-1,test2" +title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,skip_threshold,skip_high_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids +Comma Separated Answers,categorical_question,comma separated,comma-separated-answers,v1.0,en,high-inflection,3.0,medium-score,2.0,low-score,2.0,skip-score,Generic error,Please choose your comma separated answer,We need to know this for a proper risk assessment,[],,,"""This, is, the, first"",""This, is, the, second""","3.0,2.0","test-1,test2" diff --git a/home/tests/import-export-data/multiple_assessments.csv b/home/tests/import-export-data/multiple_assessments.csv index 9d61e4bb..d88ec00b 100644 --- a/home/tests/import-export-data/multiple_assessments.csv +++ b/home/tests/import-export-data/multiple_assessments.csv @@ -1,11 +1,11 @@ -title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the first question,We need to know this for a proper risk assessment,Please retry,,,"A,B","4.0,1.0","test-1,test-2" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the second question,We need to know this for a proper risk assessment,We did not quite get that,,,"A,B,C","1.0,3.0,4.0","test-1,test-2,test-3" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the third question,We need to know this for a proper risk assessment,Sorry we did not quite get that,,,"A,B,C","2.0,1.0,2.0","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know this for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know this for a proper risk assessment,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" -Freetext Test,freetext_question,Free-text,freetext-test,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,Generic error message,Did you find the information useful,We need to know if the information was useful,,,,,, -Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, -Year of Birth,year_of_birth_question,year-of-birth,year-of-birth,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,What's your year of birth,We need to know some things,Your year of birth must be between {current_year} and {lower_bound},,,,, -Weather Trivia,integer_question,weather-trivia,weather-trivia,v1.0,en,,,,,,"Sorry, we didn't quite get that.",What's the coldest weather you're experienced?,We need to know some things,Your reply should be between {min} and {max},20,-70,,, +title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,skip_threshold,skip_high_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the first question,We need to know this for a proper risk assessment,Please retry,,,"A,B","4.0,1.0","test-1,test-2" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the second question,We need to know this for a proper risk assessment,We did not quite get that,,,"A,B,C","1.0,3.0,4.0","test-1,test-2,test-3" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the third question,We need to know this for a proper risk assessment,Sorry we did not quite get that,,,"A,B,C","2.0,1.0,2.0","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know this for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know this for a proper risk assessment,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" +Freetext Test,freetext_question,Free-text,freetext-test,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,Generic error message,Did you find the information useful,We need to know if the information was useful,,,,,, +Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, +Year of Birth,year_of_birth_question,year-of-birth,year-of-birth,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What's your year of birth,We need to know some things,Your year of birth must be between {current_year} and {lower_bound},,,,, +Weather Trivia,integer_question,weather-trivia,weather-trivia,v1.0,en,,,,,,0.0,,"Sorry, we didn't quite get that.",What's the coldest weather you're experienced?,We need to know some things,Your reply should be between {min} and {max},20,-70,,, diff --git a/home/tests/import-export-data/results_assessments.csv b/home/tests/import-export-data/results_assessments.csv index 4e164b97..47d2fa9d 100644 --- a/home/tests/import-export-data/results_assessments.csv +++ b/home/tests/import-export-data/results_assessments.csv @@ -1,27 +1,27 @@ -title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids -Health Assessment Simple,categorical_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" -Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" -Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" -Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" -Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,Just a generic error,Who invented the light bulb?,We need to know this for a proper risk assessment,We didn't quite get that,,,"Thomas Edison,Nikola Tesla,Albert Einstein","2.0,2.0,0.0","test-1,test-2,test-3" -Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,Just a generic error,Some planes can fly faster than the speed of light?,We need to know this for a proper risk assessment,We didn't quite get that,,,"True,False","0.0,2.0","test-1,test-2" -Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,Just a generic error,In what century was the mechanical clock invented?,We need to know this for a proper risk assessment,This is an error message,,,"13th century,16th century,18th century,14th century","0.0,0.0,0.0,2.0","test-1,test-2,test-3,test-4" -Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" -Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" -Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" -Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,This is a generic error,How many square feet is the average adult human’s skin?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"19 feet,21 feet,15 feet","2.0,0.0,0.0","test-1,test-2,test-3" -Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,This is a generic error,What type of blood cells fight infections and diseases?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"White blood cells,Red blood cells,Stem cells","2.0,0.0,0.0","test-1,test-2,test-3" -Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,This is a generic error,What does cartilage link?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Joints and bones,Digestive system","2.0,0.0","test-1,test-2" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,Aureolin is a shade of what color?,We need to know this for a proper risk assessment,Sorry we don't understand,,,"Pink,Yellow,Blue","0.0,1.0,0.0","test-1,test-2,test-3" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,How many ghosts chase Pac-Man at the start of each game?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"2,4.0,3","0.0,2.0,0.0","test-1,test-2,test-3" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,What Renaissance artist is buried in Rome's Pantheon?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Raphael,Angelo,Rijkaard","2.0,0.0,0.0","test-1,test-2,test-3" -Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,What game studio makes the Red Dead Redemption series?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Rockstar,Capcom,Konami","1.0,0.0,0.0","test-1,test-2,test-3" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the first question,We need to know this for a proper risk assessment,Please retry,,,"A,B","4.0,1.0","test-1,test-2" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the second question,We need to know this for a proper risk assessment,We did not quite get that,,,"A,B,C","1.0,3.0,4.0","test-1,test-2,test-3" -Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,We did not quite get that,Select a number for the third question,We need to know this for a proper risk assessment,Sorry we did not quite get that,,,"A,B,C","2.0,1.0,2.0","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know this for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" -Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know this for a proper risk assessment,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" -Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, -Year of Birth,year_of_birth_question,year-of-birth,year-of-birth,v1.0,en,,,,,,This a generic error,What's your year of birth?,We need to know some things,You entered an invalid year,,,,, -Freetext Type Question,freetext_question,freetext-type-question,freetext-type-question,v1.0,en,,,,,,This a generic error,Can you provide feedback on service rating?,We need to know some things,,,,,, +title,question_type,tags,slug,version,locale,high_result_page,high_inflection,medium_result_page,medium_inflection,low_result_page,skip_threshold,skip_high_result_page,generic_error,question,explainer,error,min,max,answers,scores,semantic_ids +Health Assessment Simple,categorical_question,checker,Health-assessment-simple,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't under stand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.5,4.5","test-1,test-2,test-3" +Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" +Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" +Geography Trivia 2,categorical_question,"trivia,geography",Geography-trivia-2,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" +Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,2.0,skip-score,Just a generic error,Who invented the light bulb?,We need to know this for a proper risk assessment,We didn't quite get that,,,"Thomas Edison,Nikola Tesla,Albert Einstein","2.0,2.0,0.0","test-1,test-2,test-3" +Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,2.0,skip-score,Just a generic error,Some planes can fly faster than the speed of light?,We need to know this for a proper risk assessment,We didn't quite get that,,,"True,False","0.0,2.0","test-1,test-2" +Engineering Trivia,categorical_question,engineering,engineering-trivia,v1.0,en,high-inflection,6.0,medium-score,4.0,low-score,2.0,skip-score,Just a generic error,In what century was the mechanical clock invented?,We need to know this for a proper risk assessment,This is an error message,,,"13th century,16th century,18th century,14th century","0.0,0.0,0.0,2.0","test-1,test-2,test-3,test-4" +Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country is known as 'The Emerald Isle'?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Maldives,Ireland,Philippines","0.0,2.0,0.0","test-1,test-2,test-3" +Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What country has the longest coastline?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Russia,Indonesia,Canada","0.0,0.0,2.0","test-1,test-2,test-3" +Geography Trivia,categorical_question,"trivia,geography",geography-trivia,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,Which of these countries is NOT in Asia?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Bosnia,Israel,Thailand","2.0,0.0,0.0","test-1,test-2,test-3" +Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How many square feet is the average adult human’s skin?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"19 feet,21 feet,15 feet","2.0,0.0,0.0","test-1,test-2,test-3" +Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What type of blood cells fight infections and diseases?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"White blood cells,Red blood cells,Stem cells","2.0,0.0,0.0","test-1,test-2,test-3" +Medical Trivia,categorical_question,"medicine,trivia",medical-trivia,v1.0,en,high-inflection,4.5,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What does cartilage link?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Joints and bones,Digestive system","2.0,0.0","test-1,test-2" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,Aureolin is a shade of what color?,We need to know this for a proper risk assessment,Sorry we don't understand,,,"Pink,Yellow,Blue","0.0,1.0,0.0","test-1,test-2,test-3" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How many ghosts chase Pac-Man at the start of each game?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"2,4.0,3","0.0,2.0,0.0","test-1,test-2,test-3" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What Renaissance artist is buried in Rome's Pantheon?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Raphael,Angelo,Rijkaard","2.0,0.0,0.0","test-1,test-2,test-3" +Trivia Assessment,categorical_question,astrophysics,trivia-assessment,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,What game studio makes the Red Dead Redemption series?,We need to know this for a proper risk assessment,Sorry we didn't get that,,,"Rockstar,Capcom,Konami","1.0,0.0,0.0","test-1,test-2,test-3" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the first question,We need to know this for a proper risk assessment,Please retry,,,"A,B","4.0,1.0","test-1,test-2" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the second question,We need to know this for a proper risk assessment,We did not quite get that,,,"A,B,C","1.0,3.0,4.0","test-1,test-2,test-3" +Random Choice,categorical_question,"Random,selection",random-choice,v1.0,en,high-inflection,4.0,medium-score,3.0,low-score,2.0,skip-score,We did not quite get that,Select a number for the third question,We need to know this for a proper risk assessment,Sorry we did not quite get that,,,"A,B,C","2.0,1.0,2.0","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How often do you check your blood pressure,We need to know this for a proper risk assessment,Sorry we don't understand.,,,"Once a week,Twice a week,Thrice a week","1.0,3.0,4.5","test-1,test-2,test-3" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",Have you been vaccinated against COVID-19?,We need to know this for a proper risk assessment,Sorry we didn't quite catch that.,,,"Yes,No","3.0,1.0","test-1,test-2" +Health Assessment,categorical_question,checker,health-assessment,v1.0,en,high-inflection,4.0,medium-score,2.0,low-score,2.0,skip-score,"Sorry, we didn't quite get that.",How high is your temperature?,We need to know this for a proper risk assessment,Please choose the option that matches your answer.,,,"Between 37.5C and 38C,Between 38.1C and 40C,Between 40.1C and 41.1C","3.0,2.0,1.0","test-1,test-2,test-3" +Integer Type Question,integer_question,integer-type-question,integer-type-question,v1.0,en,high-inflection,5.0,medium-score,3.0,low-score,2.0,skip-score,This is a generic error,How much do you weigh in kilograms?,We need to test integer type questions,Sorry your min and max weight should be between 40 and 500kg.,40,500,,, +Year of Birth,year_of_birth_question,year-of-birth,year-of-birth,v1.0,en,,,,,,0.0,,This a generic error,What's your year of birth?,We need to know some things,You entered an invalid year,,,,, +Freetext Type Question,freetext_question,freetext-type-question,freetext-type-question,v1.0,en,,,,,,0.0,,This a generic error,Can you provide feedback on service rating?,We need to know some things,,,,,, diff --git a/home/tests/test_api.py b/home/tests/test_api.py index 68107875..d80eee2b 100644 --- a/home/tests/test_api.py +++ b/home/tests/test_api.py @@ -1338,13 +1338,34 @@ def create_test_data(self): } ], ) + self.skip_high_result_page = ContentPage( + title="skip result", + slug="skip-result", + enable_whatsapp=True, + whatsapp_body=[ + { + "type": "Whatsapp_Message", + "value": { + "message": "test message", + "buttons": [ + { + "type": "next_message", + "value": {"title": "You skipped a question"}, + } + ], + }, + } + ], + ) homepage = HomePage.objects.first() homepage.add_child(instance=self.high_result_page) homepage.add_child(instance=self.medium_result_page) homepage.add_child(instance=self.low_result_page) + homepage.add_child(instance=self.skip_high_result_page) self.high_result_page.save_revision().publish() self.medium_result_page.save_revision().publish() self.low_result_page.save_revision().publish() + self.skip_high_result_page.save_revision().publish() site = Site.objects.get(is_default_site=True) tag, _ = Tag.objects.get_or_create(name="tag1") self.assessment.tags.add(tag) @@ -1356,6 +1377,8 @@ def create_test_data(self): self.assessment.medium_result_page = self.medium_result_page self.assessment.medium_inflection = 2.0 self.assessment.low_result_page = self.low_result_page + self.assessment.skip_threshold = 3.0 + self.assessment.skip_high_result_page = self.skip_high_result_page self.assessment.generic_error = "This is a generic error" answers_block = blocks.ListBlock(AnswerBlock()) answers_block_value = answers_block.to_python( @@ -1518,6 +1541,24 @@ def test_assessment_endpoint(self, uclient): "triggers": [], } + meta = content["results"][0]["skip_high_result_page"].pop("meta") + assert meta["type"] == "home.ContentPage" + assert meta["slug"] == self.skip_high_result_page.slug + assert meta["parent"]["id"] == self.skip_high_result_page.get_parent().id + assert meta["locale"] == "en" + assert content["results"][0]["skip_high_result_page"] == { + "id": self.skip_high_result_page.id, + "title": self.skip_high_result_page.title, + "body": {"text": []}, + "has_children": False, + "related_pages": [], + "subtitle": "", + "quick_replies": [], + "tags": [], + "triggers": [], + } + assert content["results"][0]["skip_threshold"] == 3.0 + assert content["results"][0]["questions"][0] == { "id": self.assessment.questions[0].id, "question_type": "categorical_question", diff --git a/home/tests/test_assessment_import_export.py b/home/tests/test_assessment_import_export.py index e813d3c1..ea86ec58 100644 --- a/home/tests/test_assessment_import_export.py +++ b/home/tests/test_assessment_import_export.py @@ -281,6 +281,16 @@ def result_content_pages() -> None: ], ) + PageBuilder.build_cp( + parent=main_menu, + slug="skip-score", + title="Skip Score", + bodies=[ + WABody("Skip Score", [WABlk("*Skip Result Page")]), + MBody("Skip Score", [MBlk("Skip Result Page")]), + ], + ) + @pytest.mark.usefixtures("result_content_pages") @pytest.mark.django_db() @@ -375,6 +385,8 @@ def test_single_assessment(self, impexp: ImportExport) -> None: medium_result_page=ContentPage.objects.get(slug="medium-score"), medium_inflection=2, low_result_page=ContentPage.objects.get(slug="low-score"), + skip_threshold=2, + skip_high_result_page=ContentPage.objects.get(slug="skip-score"), generic_error="error", questions=[ { diff --git a/home/tests/test_serializers.py b/home/tests/test_serializers.py index 1f9bfaaf..63404a3e 100644 --- a/home/tests/test_serializers.py +++ b/home/tests/test_serializers.py @@ -108,6 +108,16 @@ def create_form_pages() -> None: ], ) + PageBuilder.build_cp( + parent=main_menu, + slug="skip-score", + title="Skip Score", + bodies=[ + WABody("Skip Score", [WABlk("*Skip Result Page")]), + MBody("Skip Score", [MBlk("Skip Result Page")]), + ], + ) + def create_form_with_fields() -> Assessment: """ @@ -125,6 +135,8 @@ def create_form_with_fields() -> Assessment: medium_result_page=ContentPage.objects.get(slug="medium-score"), medium_inflection=2, low_result_page=ContentPage.objects.get(slug="low-score"), + skip_threshold=2, + skip_high_result_page=ContentPage.objects.get(slug="skip-score"), generic_error="error", questions=[ { @@ -172,6 +184,8 @@ def create_form_with_missing_fields() -> Assessment: medium_result_page=ContentPage.objects.get(slug="medium-score"), medium_inflection=2, low_result_page=ContentPage.objects.get(slug="low-score"), + skip_threshold=2, + skip_high_result_page=ContentPage.objects.get(slug="skip-score"), generic_error="error", questions=[ { diff --git a/home/wagtail_hooks.py b/home/wagtail_hooks.py index 8946324c..9d15d7e8 100644 --- a/home/wagtail_hooks.py +++ b/home/wagtail_hooks.py @@ -311,6 +311,8 @@ class AssessmentAdmin(SnippetViewSet): FieldPanel("medium_result_page"), FieldPanel("medium_inflection"), FieldPanel("low_result_page"), + FieldPanel("skip_threshold"), + FieldPanel("skip_high_result_page"), ], heading="Results", ), From 0a68c3f2ae82c75595008733f0f0f900d60005f1 Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Tue, 30 Jul 2024 11:39:45 +0200 Subject: [PATCH 2/3] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebfcfb1f..cf80b814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## v1.2.0 From 2d59e19cee0d83a184050bc363fbb7f4c564ce5c Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Tue, 30 Jul 2024 11:46:20 +0200 Subject: [PATCH 3/3] Fix type --- home/export_assessments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/export_assessments.py b/home/export_assessments.py index 8bc17292..5509800f 100644 --- a/home/export_assessments.py +++ b/home/export_assessments.py @@ -85,7 +85,7 @@ def perform_export(self) -> Iterable[ExportRow]: medium_result_page=getattr(item.medium_result_page, "slug", None), medium_inflection=getattr(item, "medium_inflection", None), low_result_page=getattr(item.low_result_page, "slug", None), - skip_threshold=getattr(item, "skip_threshold", 0.0), + skip_threshold=getattr(item, "skip_threshold", "0.0"), skip_high_result_page=getattr( item.skip_high_result_page, "slug", None ),