diff --git a/README.md b/README.md index d2023f3d5..0b5c68d5e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Eyra Mono -Primary collection of Eyra projects +Primary collection of Eyra projects ## Projects @@ -19,7 +19,7 @@ Project implementing a SaaS platform based on interlinked modules called Systems * Campaign * Assignment * Lab -* Survey +* Questionnaire * Pool * Data Donation * .. @@ -28,12 +28,12 @@ Project implementing a SaaS platform based on interlinked modules called Systems * Next -Primary bundle with all features available except Link specific features. +Primary bundle with all features available except Link specific features. Next is hosted on: https://eyra.co * Link -Secundary bundle with only Panl specific features. +Secundary bundle with only Panl specific features. Link is hosted on: https://researchpanl.eu ## Banking Proxy diff --git a/core/bundles/link/seeds.exs b/core/bundles/link/seeds.exs index 14e2ce202..fd5e82c21 100644 --- a/core/bundles/link/seeds.exs +++ b/core/bundles/link/seeds.exs @@ -15,11 +15,11 @@ student_count = 1500 researcher_count = 100 researchers_per_campaign = 5 lab_count = 200 -survey_count = 600 +questionnaire_count = 600 time_slots_per_lab = 20 seats_per_time_slot = 20 -survey_url = "https://vuamsterdam.eu.qualtrics.com/jfe/form/SV_4Po8iTxbvcxtuaW" +questionnaire_url = "https://vuamsterdam.eu.qualtrics.com/jfe/form/SV_4Po8iTxbvcxtuaW" images = [ "raw_url=https%3A%2F%2Fimages.unsplash.com%2Fphoto-1600614908054-57142d1eec2b%3Fixid%3DMnwyMTY0MzZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2Mjc4MDc5MzY%26ixlib%3Drb-1.2.1&username=seonghojang95&name=Seongho+Jang&blur_hash=LKLy%5B%2AMd0L%3FG%3B0XSE2xDyC%25f%24zI%3B", @@ -184,9 +184,9 @@ researcher = {:ok, surveys} = Core.Repo.transaction(fn -> - for _ <- 1..survey_count do + for _ <- 1..questionnaire_count do %{ - type: :survey_tool, + type: :questionnaire_tool, promotion: %{ title: Faker.Lorem.sentence() <> " (survey)", subtitle: Faker.Lorem.sentence(), @@ -195,8 +195,8 @@ researcher = marks: ["vu"], plugin: "survey" }, - survey_tool: %{ - survey_url: Faker.Internet.url(), + questionnaire_tool: %{ + questionnaire_url: Faker.Internet.url(), # desktop_enabled: true, # phone_enabled: true, # tablet_enabled: true, @@ -250,7 +250,7 @@ Core.Repo.transaction( ) ) - if tool_type == :survey_tool do + if tool_type == :questionnaire_tool do participant_count = :random.uniform(tool.subject_count) for student <- Enum.take_random(students, participant_count) do diff --git a/core/lib/core/authorization.ex b/core/lib/core/authorization.ex index 6083e2979..dfb52e859 100644 --- a/core/lib/core/authorization.ex +++ b/core/lib/core/authorization.ex @@ -24,7 +24,7 @@ defmodule Core.Authorization do # Models grant_access(Systems.Campaign.Model, [:visitor, :member]) - grant_access(Systems.Survey.ToolModel, [:owner, :coordinator, :participant]) + grant_access(Systems.Questionnaire.ToolModel, [:owner, :coordinator, :participant]) grant_access(Systems.Lab.ToolModel, [:owner, :coordinator, :participant]) grant_access(Systems.DataDonation.ToolModel, [:owner, :coordinator, :participant]) grant_access(Systems.Benchmark.SpotModel, [:owner]) @@ -71,9 +71,9 @@ defmodule Core.Authorization do grant_access(CoreWeb.User.Profile, [:member]) grant_access(CoreWeb.User.Settings, [:member]) grant_access(CoreWeb.User.SecuritySettings, [:member]) - grant_access(CoreWeb.FakeSurvey, [:member]) + grant_access(CoreWeb.FakeQuestionnaire, [:member]) - grant_actions(CoreWeb.FakeSurveyController, %{ + grant_actions(CoreWeb.FakeQuestionnaireController, %{ index: [:visitor, :member] }) diff --git a/core/lib/core/factories.ex b/core/lib/core/factories.ex index a187d2d38..6259204de 100644 --- a/core/lib/core/factories.ex +++ b/core/lib/core/factories.ex @@ -22,7 +22,7 @@ defmodule Core.Factories do Assignment, Crew, Support, - Survey, + Questionnaire, Lab, DataDonation, Benchmark, @@ -142,8 +142,8 @@ defmodule Core.Factories do } end - def build(:survey_tool) do - build(:survey_tool, %{}) + def build(:questionnaire_tool) do + build(:questionnaire_tool, %{}) end def build(:lab_tool) do @@ -412,14 +412,14 @@ defmodule Core.Factories do def build(:tool_ref, %{} = attributes) do {item, attributes} = Map.pop(attributes, :item, build(:project_item)) - {survey_tool, attributes} = Map.pop(attributes, :survey_tool, nil) + {questionnaire_tool, attributes} = Map.pop(attributes, :questionnaire_tool, nil) {lab_tool, attributes} = Map.pop(attributes, :lab_tool, nil) {data_donation_tool, attributes} = Map.pop(attributes, :data_donation_tool, nil) {benchmark_tool, attributes} = Map.pop(attributes, :benchmark_tool, nil) %Project.ToolRefModel{ item: item, - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, lab_tool: lab_tool, data_donation_tool: data_donation_tool, benchmark_tool: benchmark_tool @@ -462,13 +462,16 @@ defmodule Core.Factories do {nil, attributes} end - {survey_tool, attributes} = + {questionnaire_tool, attributes} = if lab_tool == nil do tool_auth_node = build(:auth_node, %{parent: auth_node}) - case Map.pop(attributes, :survey_tool, nil) do - {nil, attributes} -> {build(:survey_tool, %{auth_node: tool_auth_node}), attributes} - {survey_tool, attributes} -> {survey_tool, attributes} + case Map.pop(attributes, :questionnaire_tool, nil) do + {nil, attributes} -> + {build(:questionnaire_tool, %{auth_node: tool_auth_node}), attributes} + + {questionnaire_tool, attributes} -> + {questionnaire_tool, attributes} end else {nil, attributes} @@ -476,7 +479,7 @@ defmodule Core.Factories do %Assignment.ExperimentModel{ auth_node: auth_node, - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, lab_tool: lab_tool } |> struct!(attributes) @@ -609,10 +612,10 @@ defmodule Core.Factories do |> struct!(attributes) end - def build(:survey_tool, %{} = attributes) do + def build(:questionnaire_tool, %{} = attributes) do {auth_node, attributes} = Map.pop(attributes, :auth_node, build(:auth_node)) - %Survey.ToolModel{ + %Questionnaire.ToolModel{ auth_node: auth_node } |> struct!(attributes) diff --git a/core/lib/core_web/controllers/fake_survey_controller.ex b/core/lib/core_web/controllers/fake_questionnaire_controller.ex similarity index 79% rename from core/lib/core_web/controllers/fake_survey_controller.ex rename to core/lib/core_web/controllers/fake_questionnaire_controller.ex index 18648ce8b..ba0ae797b 100644 --- a/core/lib/core_web/controllers/fake_survey_controller.ex +++ b/core/lib/core_web/controllers/fake_questionnaire_controller.ex @@ -1,4 +1,4 @@ -defmodule CoreWeb.FakeSurveyController do +defmodule CoreWeb.FakeQuestionnaireController do use CoreWeb, :controller def index(conn, _params) do diff --git a/core/lib/core_web/controllers/fake_questionnaire_html.ex b/core/lib/core_web/controllers/fake_questionnaire_html.ex new file mode 100644 index 000000000..16b75320c --- /dev/null +++ b/core/lib/core_web/controllers/fake_questionnaire_html.ex @@ -0,0 +1,5 @@ +defmodule CoreWeb.FakeQuestionnaireHTML do + use CoreWeb, :html + + embed_templates("fake_questionnaire_html/*") +end diff --git a/core/lib/core_web/controllers/fake_survey_html/index.html.eex b/core/lib/core_web/controllers/fake_questionnaire_html/index.html.eex similarity index 100% rename from core/lib/core_web/controllers/fake_survey_html/index.html.eex rename to core/lib/core_web/controllers/fake_questionnaire_html/index.html.eex diff --git a/core/lib/core_web/controllers/fake_survey_html.ex b/core/lib/core_web/controllers/fake_survey_html.ex deleted file mode 100644 index a0739651c..000000000 --- a/core/lib/core_web/controllers/fake_survey_html.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule CoreWeb.FakeSurveyHTML do - use CoreWeb, :html - - embed_templates("fake_survey_html/*") -end diff --git a/core/lib/core_web/live/fake_survey.ex b/core/lib/core_web/live/fake_questionnaire.ex similarity index 61% rename from core/lib/core_web/live/fake_survey.ex rename to core/lib/core_web/live/fake_questionnaire.ex index 2520728f0..1d7861883 100644 --- a/core/lib/core_web/live/fake_survey.ex +++ b/core/lib/core_web/live/fake_questionnaire.ex @@ -1,4 +1,4 @@ -defmodule CoreWeb.FakeSurvey do +defmodule CoreWeb.FakeQuestionnaire do @moduledoc """ The home screen. """ @@ -25,14 +25,14 @@ defmodule CoreWeb.FakeSurvey do def render(assigns) do ~H"""
- + - Fake survey - This fake survey is used to validate the survey tool flow with an external tool. + Fake questionnaire + This fake questionnaire is used to validate the survey tool flow with an external tool. <.spacing value="M" /> - +
""" diff --git a/core/lib/core_web/live/routes.ex b/core/lib/core_web/live/routes.ex index 96c9ecfba..6383887bc 100644 --- a/core/lib/core_web/live/routes.ex +++ b/core/lib/core_web/live/routes.ex @@ -8,7 +8,7 @@ defmodule CoreWeb.Live.Routes do scope "/", CoreWeb do pipe_through(:browser) get("/switch-language/:locale", LanguageSwitchController, :index) - live("/fake_survey/:id", FakeSurvey) + live("/fake_survey/:id", FakeQuestionnaire) end if Mix.env() in [:test] do diff --git a/core/lib/core_web/loaders.ex b/core/lib/core_web/loaders.ex index ef6943aa7..1ad833e4d 100644 --- a/core/lib/core_web/loaders.ex +++ b/core/lib/core_web/loaders.ex @@ -8,6 +8,6 @@ defmodule CoreWeb.Loaders do defloader(:campaign, &Systems.Campaign.Public.get!/1) defloader(:promotion, &Systems.Promotion.Public.get!/1) defloader(:assignment, &Systems.Assignment.Public.get!/1) - defloader(:survey_tool, &Systems.Survey.Public.get_survey_tool!/1) + defloader(:questionnaire_tool, &Systems.Questionnaire.Public.get_questionnaire_tool!/1) defloader(:user_profile, &Core.Accounts.get_profile/1) end diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po b/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po index 3bd777f5f..00f3ab747 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po @@ -14,17 +14,13 @@ msgstr "" msgid "config.nrofsubjects.label" msgstr "How many participants do you need?" -#, elixir-autogen, elixir-format -msgid "platforms.title" -msgstr "Platforms" - #, elixir-autogen, elixir-format msgid "content.title" msgstr "Data Donation" #, elixir-autogen, elixir-format msgid "task.donate.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Enables participants to donate data." #, elixir-autogen, elixir-format msgid "task.donate.title" @@ -32,43 +28,43 @@ msgstr "Donate" #, elixir-autogen, elixir-format msgid "task.download.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Instructs participants on how to download digital trace data." #, elixir-autogen, elixir-format msgid "task.download.title" -msgstr "Download DDP" +msgstr "Download manual" #, elixir-autogen, elixir-format msgid "task.library.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Choose which items to add to your flow." #, elixir-autogen, elixir-format msgid "task.library.title" -msgstr "Task Library" +msgstr "Library" #, elixir-autogen, elixir-format msgid "task.list.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Add items from the library to build a custom flow for your participants." #, elixir-autogen, elixir-format msgid "task.list.title" -msgstr "Tasks" +msgstr "Participant flow" #, elixir-autogen, elixir-format msgid "task.request.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Instructs participants on how to request digital trace data." #, elixir-autogen, elixir-format msgid "task.request.title" -msgstr "Request DDP" +msgstr "Request manual" #, elixir-autogen, elixir-format -msgid "task.survey.description" -msgstr "Lorem ipsum dolor sit amet." +msgid "task.questionnaire.description" +msgstr "Redirects participants to an online questionnaire." #, elixir-autogen, elixir-format -msgid "task.survey.title" -msgstr "Survey" +msgid "task.questionnaire.title" +msgstr "Questionnaire" #, elixir-autogen, elixir-format, fuzzy msgid "task.description.label" @@ -80,11 +76,11 @@ msgstr "Title" #, elixir-autogen, elixir-format, fuzzy msgid "task.list.hint" -msgstr "Change order with the arrows" +msgstr "Use the arrows to order the flow" #, elixir-autogen, elixir-format, fuzzy msgid "task.platform.label" -msgstr "Platform" +msgstr "Organisation" #, elixir-autogen, elixir-format msgid "pdf-replace-file-button" @@ -97,3 +93,11 @@ msgstr "Select PDF" #, elixir-autogen, elixir-format msgid "pdf-select-placeholder" msgstr "Select a pdf file" + +#, elixir-autogen, elixir-format +msgid "add.to.button" +msgstr "Add" + +#, elixir-autogen, elixir-format, fuzzy +msgid "pdf-select-label" +msgstr "Manual" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po b/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po index 28119c9cd..eb7caf574 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-enums.po @@ -152,7 +152,7 @@ msgstr "Attention checks failed" #, elixir-autogen, elixir-format msgid "reject_catagories.not_completed" -msgstr "Survey not completed" +msgstr "Questionnaire not completed" #, elixir-autogen, elixir-format msgid "reject_catagories.other" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-project.po b/core/priv/gettext/en/LC_MESSAGES/eyra-project.po index 03bae17b6..6f1a875ad 100644 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-project.po +++ b/core/priv/gettext/en/LC_MESSAGES/eyra-project.po @@ -53,11 +53,11 @@ msgstr "Privacy" #, elixir-autogen, elixir-format, fuzzy msgid "tabbar.item.tasks" -msgstr "Tasks" +msgstr "Flow" #, elixir-autogen, elixir-format, fuzzy msgid "tabbar.item.tasks.forward" -msgstr "Tasks" +msgstr "Flow" #, elixir-autogen, elixir-format msgid "add.first.button" diff --git a/core/priv/gettext/en/LC_MESSAGES/eyra-survey.po b/core/priv/gettext/en/LC_MESSAGES/eyra-survey.po deleted file mode 100644 index 006fdad74..000000000 --- a/core/priv/gettext/en/LC_MESSAGES/eyra-survey.po +++ /dev/null @@ -1,11 +0,0 @@ -## "msgid"s in this file come from POT (.pot) files. -## -## Do not add, change, or remove "msgid"s manually here as -## they're tied to the ones in the corresponding POT file -## (with the same domain). -## -## Use "mix gettext.extract --merge" or "mix gettext.merge" -## to merge POT files into PO files. -msgid "" -msgstr "" -"Language: en\n" diff --git a/core/priv/gettext/en/LC_MESSAGES/link-survey.po b/core/priv/gettext/en/LC_MESSAGES/link-questionnaire.po similarity index 98% rename from core/priv/gettext/en/LC_MESSAGES/link-survey.po rename to core/priv/gettext/en/LC_MESSAGES/link-questionnaire.po index c4b247598..a07cd9052 100644 --- a/core/priv/gettext/en/LC_MESSAGES/link-survey.po +++ b/core/priv/gettext/en/LC_MESSAGES/link-questionnaire.po @@ -48,7 +48,7 @@ msgstr "To redirect participants back to Panl at the end of the survey, copy the #, elixir-autogen, elixir-format msgid "redirect.title" -msgstr "Redirect URL (End of Survey)" +msgstr "Redirect URL (End of Questionnaire)" #, elixir-autogen, elixir-format msgid "devices.title" @@ -132,7 +132,7 @@ msgstr "Sample" #, elixir-autogen, elixir-format msgid "form.title" -msgstr "Survey" +msgstr "Questionnaire" #, elixir-autogen, elixir-format msgid "campaign.overview.title" @@ -180,7 +180,7 @@ msgstr "To obtain the link to your Qualtrics survey, follow %{link}. Paste your #, elixir-autogen, elixir-format msgid "study.link.title" -msgstr "Anonymous Survey Link" +msgstr "Anonymous Questionnaire Link" #, elixir-autogen, elixir-format msgid "panlid.instructions.link" diff --git a/core/priv/gettext/eyra-data-donation.pot b/core/priv/gettext/eyra-data-donation.pot index 73aedaf4e..b294db992 100644 --- a/core/priv/gettext/eyra-data-donation.pot +++ b/core/priv/gettext/eyra-data-donation.pot @@ -14,10 +14,6 @@ msgstr "" msgid "config.nrofsubjects.label" msgstr "" -#, elixir-autogen, elixir-format -msgid "platforms.title" -msgstr "" - #, elixir-autogen, elixir-format msgid "content.title" msgstr "" @@ -63,11 +59,11 @@ msgid "task.request.title" msgstr "" #, elixir-autogen, elixir-format -msgid "task.survey.description" +msgid "task.questionnaire.description" msgstr "" #, elixir-autogen, elixir-format -msgid "task.survey.title" +msgid "task.questionnaire.title" msgstr "" #, elixir-autogen, elixir-format @@ -97,3 +93,11 @@ msgstr "" #, elixir-autogen, elixir-format msgid "pdf-select-placeholder" msgstr "" + +#, elixir-autogen, elixir-format +msgid "add.to.button" +msgstr "" + +#, elixir-autogen, elixir-format +msgid "pdf-select-label" +msgstr "" diff --git a/core/priv/gettext/eyra-survey.pot b/core/priv/gettext/eyra-survey.pot deleted file mode 100644 index d231fbf6d..000000000 --- a/core/priv/gettext/eyra-survey.pot +++ /dev/null @@ -1,11 +0,0 @@ -## This file is a PO Template file. -## -## "msgid"s here are often extracted from source code. -## Add new translations manually only if they're dynamic -## translations that can't be statically extracted. -## -## Run "mix gettext.extract" to bring this file up to -## date. Leave "msgstr"s empty as changing them here as no -## effect: edit them in PO (.po) files instead. -msgid "" -msgstr "" diff --git a/core/priv/gettext/link-survey.pot b/core/priv/gettext/link-questionnaire.pot similarity index 100% rename from core/priv/gettext/link-survey.pot rename to core/priv/gettext/link-questionnaire.pot diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po index 47232a765..33525c33d 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-data-donation.po @@ -14,17 +14,13 @@ msgstr "" msgid "config.nrofsubjects.label" msgstr "Aantal gewenste deelnemers" -#, elixir-autogen, elixir-format -msgid "platforms.title" -msgstr "Platformen" - #, elixir-autogen, elixir-format msgid "content.title" msgstr "Data Donatie" #, elixir-autogen, elixir-format msgid "task.donate.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Biedt deelnemers de mogelijkheid om te doneren." #, elixir-autogen, elixir-format msgid "task.donate.title" @@ -32,15 +28,15 @@ msgstr "Donatie" #, elixir-autogen, elixir-format msgid "task.download.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Legt deelnemers uit hoe ze digital trace data kunnen downloaden." #, elixir-autogen, elixir-format msgid "task.download.title" -msgstr "Downloaden DDP" +msgstr "Download handleiding" #, elixir-autogen, elixir-format msgid "task.library.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Kies items die je aan de flow wilt toevoegen." #, elixir-autogen, elixir-format msgid "task.library.title" @@ -48,26 +44,26 @@ msgstr "Bibliotheek" #, elixir-autogen, elixir-format msgid "task.list.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Voeg items uit de bibliotheek toe om een flow te bouwen voor jouw deelnemers." #, elixir-autogen, elixir-format msgid "task.list.title" -msgstr "Taken" +msgstr "Flow voor deelnemers" #, elixir-autogen, elixir-format msgid "task.request.description" -msgstr "Lorem ipsum dolor sit amet." +msgstr "Legt deelnemers uit hoe ze digital trace data kunnen aanvragen." #, elixir-autogen, elixir-format msgid "task.request.title" -msgstr "Aanvragen DDP" +msgstr "Aanvraag handleiding" #, elixir-autogen, elixir-format -msgid "task.survey.description" -msgstr "Lorem ipsum dolor sit amet." +msgid "task.questionnaire.description" +msgstr "Stuurt deelnemers naar een online vragenlijst." #, elixir-autogen, elixir-format -msgid "task.survey.title" +msgid "task.questionnaire.title" msgstr "Vragenlijst" #, elixir-autogen, elixir-format, fuzzy @@ -84,7 +80,7 @@ msgstr "Verander volgorde met de pijltjes" #, elixir-autogen, elixir-format, fuzzy msgid "task.platform.label" -msgstr "Platform" +msgstr "Organisatie" #, elixir-autogen, elixir-format msgid "pdf-replace-file-button" @@ -97,3 +93,11 @@ msgstr "Kies PDF" #, elixir-autogen, elixir-format msgid "pdf-select-placeholder" msgstr "Kies een pdf bestand" + +#, elixir-autogen, elixir-format +msgid "add.to.button" +msgstr "Voeg toe" + +#, elixir-autogen, elixir-format, fuzzy +msgid "pdf-select-label" +msgstr "Handleiding" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-project.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-project.po index ccf33a479..ebcf8cdfd 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-project.po +++ b/core/priv/gettext/nl/LC_MESSAGES/eyra-project.po @@ -53,11 +53,11 @@ msgstr "Privacy" #, elixir-autogen, elixir-format, fuzzy msgid "tabbar.item.tasks" -msgstr "Taken" +msgstr "Flow" #, elixir-autogen, elixir-format, fuzzy msgid "tabbar.item.tasks.forward" -msgstr "Taken" +msgstr "Flow" #, elixir-autogen, elixir-format msgid "add.first.button" diff --git a/core/priv/gettext/nl/LC_MESSAGES/eyra-survey.po b/core/priv/gettext/nl/LC_MESSAGES/eyra-survey.po deleted file mode 100644 index ebb7d6837..000000000 --- a/core/priv/gettext/nl/LC_MESSAGES/eyra-survey.po +++ /dev/null @@ -1,11 +0,0 @@ -## "msgid"s in this file come from POT (.pot) files. -## -## Do not add, change, or remove "msgid"s manually here as -## they're tied to the ones in the corresponding POT file -## (with the same domain). -## -## Use "mix gettext.extract --merge" or "mix gettext.merge" -## to merge POT files into PO files. -msgid "" -msgstr "" -"Language: nl\n" diff --git a/core/priv/gettext/nl/LC_MESSAGES/link-survey.po b/core/priv/gettext/nl/LC_MESSAGES/link-questionnaire.po similarity index 99% rename from core/priv/gettext/nl/LC_MESSAGES/link-survey.po rename to core/priv/gettext/nl/LC_MESSAGES/link-questionnaire.po index 04511388e..b7435f2b8 100644 --- a/core/priv/gettext/nl/LC_MESSAGES/link-survey.po +++ b/core/priv/gettext/nl/LC_MESSAGES/link-questionnaire.po @@ -48,7 +48,7 @@ msgstr "De redirect URL zorgt ervoor dat deelnemers teruggestuurd worden naar Pa #, elixir-autogen, elixir-format msgid "redirect.title" -msgstr "Redirect URL (End of Survey)" +msgstr "Redirect URL (End of Questionnaire)" #, elixir-autogen, elixir-format msgid "devices.title" @@ -180,7 +180,7 @@ msgstr "Volg %{link} om jouw Qualtrics vragenlijst link aan te maken op te halen #, elixir-autogen, elixir-format msgid "study.link.title" -msgstr "Anonymous Survey Link" +msgstr "Anonymous Questionnaire Link" #, elixir-autogen, elixir-format msgid "panlid.instructions.link" diff --git a/core/priv/repo/migrations/20230707084349_rename_survey.exs b/core/priv/repo/migrations/20230707084349_rename_survey.exs new file mode 100644 index 000000000..17bd14f56 --- /dev/null +++ b/core/priv/repo/migrations/20230707084349_rename_survey.exs @@ -0,0 +1,25 @@ +defmodule Core.Repo.Migrations.RenameSurvey do + use Ecto.Migration + + def up do + rename(table(:survey_tools), :survey_url, to: :questionnaire_url) + rename(table(:survey_tools), to: table(:questionnaire_tools)) + + rename(table(:experiments), :survey_tool_id, to: :questionnaire_tool_id) + + rename(table(:tool_refs), :survey_tool_id, to: :questionnaire_tool_id) + rename(table(:data_donation_tasks), :survey_task_id, to: :questionnaire_task_id) + rename(table(:data_donation_survey_tasks), to: table(:data_donation_questionnaire_tasks)) + end + + def down do + rename(table(:data_donation_tasks), :questionnaire_task_id, to: :survey_task_id) + rename(table(:data_donation_questionnaire_tasks), to: table(:data_donation_survey_tasks)) + rename(table(:tool_refs), :questionnaire_tool_id, to: :survey_tool_id) + + rename(table(:experiments), :questionnaire_tool_id, to: :survey_tool_id) + + rename(table(:questionnaire_tools), to: table(:survey_tools)) + rename(table(:survey_tools), :questionnaire_url, to: :survey_url) + end +end diff --git a/core/priv/repo/seeds.exs b/core/priv/repo/seeds.exs index e9078d4e2..327c1387f 100644 --- a/core/priv/repo/seeds.exs +++ b/core/priv/repo/seeds.exs @@ -12,7 +12,7 @@ # # -_survey_url = "https://vuamsterdam.eu.qualtrics.com/jfe/form/SV_4Po8iTxbvcxtuaW" +_questionnaire_url = "https://vuamsterdam.eu.qualtrics.com/jfe/form/SV_4Po8iTxbvcxtuaW" images = [ "raw_url=https%3A%2F%2Fimages.unsplash.com%2Fphoto-1498462440456-0dba182e775b%3Fixid%3DMnwyMTY0MzZ8MHwxfHNlYXJjaHw5fHx3YXRlcnxlbnwwfHx8fDE2MjE3NzY0MjA%26ixlib%3Drb-1.2.1&username=samaradoole&name=Samara+Doole&blur_hash=LtI~0%3Ft7aeof~qofazayt6f6j%5Bf6", diff --git a/core/systems/assignment/_public.ex b/core/systems/assignment/_public.ex index 80e0ed9ea..e655b9198 100644 --- a/core/systems/assignment/_public.ex +++ b/core/systems/assignment/_public.ex @@ -22,7 +22,7 @@ defmodule Systems.Assignment.Public do Budget, Assignment, Crew, - Survey, + Questionnaire, Lab } @@ -65,9 +65,9 @@ defmodule Systems.Assignment.Public do |> Repo.one() end - def get_by_tool(%Survey.ToolModel{id: id}, preload) do + def get_by_tool(%Questionnaire.ToolModel{id: id}, preload) do query_by_tool(preload) - |> where([assignment, experiment], experiment.survey_tool_id == ^id) + |> where([assignment, experiment], experiment.questionnaire_tool_id == ^id) |> Repo.one() end @@ -169,12 +169,12 @@ defmodule Systems.Assignment.Public do def copy_experiment( %Assignment.ExperimentModel{} = experiment, - %Survey.ToolModel{} = tool, + %Questionnaire.ToolModel{} = tool, auth_node ) do %Assignment.ExperimentModel{} |> Assignment.ExperimentModel.changeset(:copy, Map.from_struct(experiment)) - |> Ecto.Changeset.put_assoc(:survey_tool, tool) + |> Ecto.Changeset.put_assoc(:questionnaire_tool, tool) |> Ecto.Changeset.put_assoc(:auth_node, auth_node) |> Repo.insert!() end @@ -192,11 +192,11 @@ defmodule Systems.Assignment.Public do end def copy_tool( - %Assignment.ExperimentModel{survey_tool: %{auth_node: tool_auth_node} = tool}, + %Assignment.ExperimentModel{questionnaire_tool: %{auth_node: tool_auth_node} = tool}, experiment_auth_node ) do tool_auth_node = Authorization.copy(tool_auth_node, experiment_auth_node) - Survey.Public.copy(tool, tool_auth_node) + Questionnaire.Public.copy(tool, tool_auth_node) end def copy_tool( @@ -207,8 +207,8 @@ defmodule Systems.Assignment.Public do Lab.Public.copy(tool, tool_auth_node) end - def delete_tool(multi, %{survey_tool: tool}) when not is_nil(tool) do - multi |> Utility.EctoHelper.delete(:survey_tool, tool) + def delete_tool(multi, %{questionnaire_tool: tool}) when not is_nil(tool) do + multi |> Utility.EctoHelper.delete(:questionnaire_tool, tool) end def delete_tool(multi, %{lab_tool: %{time_slots: time_slots} = tool}) when not is_nil(tool) do @@ -500,7 +500,9 @@ defmodule Systems.Assignment.Public do changeset.valid? && tool_ready?(experiment) end - def tool_ready?(%{survey_tool: tool}) when not is_nil(tool), do: Survey.Public.ready?(tool) + def tool_ready?(%{questionnaire_tool: tool}) when not is_nil(tool), + do: Questionnaire.Public.ready?(tool) + def tool_ready?(%{lab_tool: tool}) when not is_nil(tool), do: Lab.Public.ready?(tool) defp assignable_field(%Assignment.ExperimentModel{}), do: :assignable_experiment @@ -523,7 +525,7 @@ defmodule Systems.Assignment.Public do |> Repo.one() end - def attention_list_enabled?(%{assignable_experiment: %{survey_tool: tool}}) + def attention_list_enabled?(%{assignable_experiment: %{questionnaire_tool: tool}}) when not is_nil(tool), do: true @@ -537,10 +539,10 @@ defmodule Systems.Assignment.Public do } end - def task_labels(%{assignable_experiment: %{survey_tool: tool}}) when not is_nil(tool) do + def task_labels(%{assignable_experiment: %{questionnaire_tool: tool}}) when not is_nil(tool) do %{ - pending: dgettext("link-survey", "pending.label"), - participated: dgettext("link-survey", "participated.label") + pending: dgettext("link-questionnaire", "pending.label"), + participated: dgettext("link-questionnaire", "participated.label") } end diff --git a/core/systems/assignment/_switch.ex b/core/systems/assignment/_switch.ex index ef59eabcb..3ef7ace32 100644 --- a/core/systems/assignment/_switch.ex +++ b/core/systems/assignment/_switch.ex @@ -86,7 +86,7 @@ defmodule Systems.Assignment.Switch do handle(signal, object) end - def handle(:survey_tool_updated, tool), do: handle(:tool_updated, tool) + def handle(:questionnaire_tool_updated, tool), do: handle(:tool_updated, tool) def handle(:lab_tool_updated, tool), do: handle(:tool_updated, tool) def handle(:data_donation_tool_updated, tool), do: handle(:tool_updated, tool) diff --git a/core/systems/assignment/callback_page.ex b/core/systems/assignment/callback_page.ex index 2def382fd..f1498dee3 100644 --- a/core/systems/assignment/callback_page.ex +++ b/core/systems/assignment/callback_page.ex @@ -3,7 +3,7 @@ defmodule Systems.Assignment.CallbackPage do The redirect page to complete a task """ use CoreWeb, :live_view - use CoreWeb.Layouts.Workspace.Component, :survey + use CoreWeb.Layouts.Workspace.Component, :questionnaire alias Frameworks.Pixel.Text alias Frameworks.Pixel.Button diff --git a/core/systems/assignment/ethical_form.ex b/core/systems/assignment/ethical_form.ex index 9bc7d6f44..e44d4b46b 100644 --- a/core/systems/assignment/ethical_form.ex +++ b/core/systems/assignment/ethical_form.ex @@ -35,7 +35,7 @@ defmodule Systems.Assignment.EthicalForm do ethical_label = %{ id: :statement, - value: dgettext("link-survey", "ethical.label"), + value: dgettext("link-questionnaire", "ethical.label"), accent: :tertiary, active: entity.ethical_approval } @@ -89,7 +89,7 @@ defmodule Systems.Assignment.EthicalForm do defp ethical_review_link() do link_as_string( - dgettext("link-survey", "ethical.review.link"), + dgettext("link-questionnaire", "ethical.review.link"), "https://vueconomics.eu.qualtrics.com/jfe/form/SV_1SKjMzceWRZIk9D" ) end @@ -109,8 +109,8 @@ defmodule Systems.Assignment.EthicalForm do ~H"""
<.form id={@id} :let={form} for={@changeset} phx-change="save" phx-target={@myself} > - <%= dgettext("link-survey", "ethical.title") %> - <%= raw(dgettext("link-survey", "ethical.description", link: ethical_review_link())) %> + <%= dgettext("link-questionnaire", "ethical.title") %> + <%= raw(dgettext("link-questionnaire", "ethical.description", link: ethical_review_link())) %> <.spacing value="M" /> @@ -125,7 +125,7 @@ defmodule Systems.Assignment.EthicalForm do <.checkbox form={form} field={:ethical_approval} - label_text={dgettext("link-survey", "ethical.label")} + label_text={dgettext("link-questionnaire", "ethical.label")} label_color="text-white" accent={:tertiary} background={:dark} diff --git a/core/systems/assignment/experiment_form.ex b/core/systems/assignment/experiment_form.ex index 05715826a..4e60519b5 100644 --- a/core/systems/assignment/experiment_form.ex +++ b/core/systems/assignment/experiment_form.ex @@ -121,19 +121,19 @@ defmodule Systems.Assignment.ExperimentForm do <.number_input form={form} field={:duration} - label_text={dgettext("link-survey", "duration.label")} + label_text={dgettext("link-questionnaire", "duration.label")} /> <.spacing value="M" /> <.number_input form={form} field={:subject_count} - label_text={dgettext("link-survey", "config.nrofsubjects.label")} + label_text={dgettext("link-questionnaire", "config.nrofsubjects.label")} /> <.spacing value="M" /> - <%= dgettext("link-survey", "language.title") %> - <%= dgettext("link-survey", "languages.label") %> + <%= dgettext("link-questionnaire", "language.title") %> + <%= dgettext("link-questionnaire", "languages.label") %> <.spacing value="S" /> <.live_component module={Selector} @@ -144,8 +144,8 @@ defmodule Systems.Assignment.ExperimentForm do /> <.spacing value="XL" /> - <%= dgettext("link-survey", "devices.title") %> - <%= dgettext("link-survey", "devices.label") %> + <%= dgettext("link-questionnaire", "devices.title") %> + <%= dgettext("link-questionnaire", "devices.label") %> <.spacing value="S" /> <.live_component module={Selector} diff --git a/core/systems/assignment/experiment_model.ex b/core/systems/assignment/experiment_model.ex index b5a542a42..17835704d 100644 --- a/core/systems/assignment/experiment_model.ex +++ b/core/systems/assignment/experiment_model.ex @@ -11,14 +11,14 @@ defmodule Systems.Assignment.ExperimentModel do import Ecto.Changeset alias Systems.{ - Survey, + Questionnaire, Lab } schema "experiments" do belongs_to(:auth_node, Core.Authorization.Node) - belongs_to(:survey_tool, Systems.Survey.ToolModel) + belongs_to(:questionnaire_tool, Systems.Questionnaire.ToolModel) belongs_to(:lab_tool, Systems.Lab.ToolModel) field(:subject_count, :integer) @@ -89,40 +89,44 @@ defmodule Systems.Assignment.ExperimentModel do def duration(_), do: 0 - def apply_label(%{survey_tool: tool}) when not is_nil(tool), - do: dgettext("link-survey", "apply.cta.title") + def apply_label(%{questionnaire_tool: tool}) when not is_nil(tool), + do: dgettext("link-questionnaire", "apply.cta.title") def apply_label(%{lab_tool: tool}) when not is_nil(tool), do: dgettext("link-lab", "apply.cta.title") def apply_label(_), do: "" - def open_label(%{survey_tool: tool}) when not is_nil(tool), - do: dgettext("link-survey", "open.cta.title") + def open_label(%{questionnaire_tool: tool}) when not is_nil(tool), + do: dgettext("link-questionnaire", "open.cta.title") def open_label(%{lab_tool: tool}) when not is_nil(tool), do: dgettext("link-lab", "open.cta.title") def open_label(_), do: "" - def ready?(%{survey_tool: tool}) when not is_nil(tool), do: Systems.Survey.Public.ready?(tool) + def ready?(%{questionnaire_tool: tool}) when not is_nil(tool), + do: Systems.Questionnaire.Public.ready?(tool) + def ready?(%{lab_tool: tool}) when not is_nil(tool), do: Systems.Lab.Public.ready?(tool) - def external_path(%{survey_tool: survey_tool}, panl_id) do - Survey.ToolModel.external_path(survey_tool, panl_id) + def external_path(%{questionnaire_tool: questionnaire_tool}, panl_id) do + Questionnaire.ToolModel.external_path(questionnaire_tool, panl_id) end def external_path(_, _), do: nil - def tool_id(%{survey_tool_id: tool_id}) when not is_nil(tool_id), do: tool_id + def tool_id(%{questionnaire_tool_id: tool_id}) when not is_nil(tool_id), do: tool_id def tool_id(%{lab_tool_id: tool_id}) when not is_nil(tool_id), do: tool_id - def tool_form(%{survey_tool_id: tool_id}) when not is_nil(tool_id), do: Survey.ToolForm + def tool_form(%{questionnaire_tool_id: tool_id}) when not is_nil(tool_id), + do: Questionnaire.ToolForm + def tool_form(%{lab_tool_id: tool_id}) when not is_nil(tool_id), do: Lab.ToolForm - def tool_field(%Survey.ToolModel{}), do: :survey_tool + def tool_field(%Questionnaire.ToolModel{}), do: :questionnaire_tool def tool_field(%Lab.ToolModel{}), do: :lab_tool - def tool_id_field(%Survey.ToolModel{}), do: :survey_tool_id + def tool_id_field(%Questionnaire.ToolModel{}), do: :questionnaire_tool_id def tool_id_field(%Lab.ToolModel{}), do: :lab_tool_id end diff --git a/core/systems/assignment/model.ex b/core/systems/assignment/model.ex index 6e071ea05..66962fc49 100644 --- a/core/systems/assignment/model.ex +++ b/core/systems/assignment/model.ex @@ -68,7 +68,7 @@ defmodule Systems.Assignment.Model do assignable_experiment: [ auth_node: [:role_assignments], lab_tool: [:time_slots], - survey_tool: [auth_node: [:role_assignments]] + questionnaire_tool: [auth_node: [:role_assignments]] ], budget: [:currency, :fund, :reserve], auth_node: [:role_assignments] diff --git a/core/systems/campaign/_assembly.ex b/core/systems/campaign/_assembly.ex index 5dcbd781d..5baf08824 100644 --- a/core/systems/campaign/_assembly.ex +++ b/core/systems/campaign/_assembly.ex @@ -11,7 +11,7 @@ defmodule Systems.Campaign.Assembly do alias Systems.{ Campaign, Assignment, - Survey, + Questionnaire, Lab, Crew, Pool, @@ -82,7 +82,7 @@ defmodule Systems.Campaign.Assembly do context(tool_type).create_tool(tool_attrs, tool_auth_node) end - defp context(:online), do: Survey.Public + defp context(:online), do: Questionnaire.Public defp context(:lab), do: Lab.Public defp assignment_attrs(), do: %{director: :campaign} diff --git a/core/systems/campaign/_public.ex b/core/systems/campaign/_public.ex index cca9811ad..96ff61ab2 100644 --- a/core/systems/campaign/_public.ex +++ b/core/systems/campaign/_public.ex @@ -17,7 +17,7 @@ defmodule Systems.Campaign.Public do Campaign, Promotion, Assignment, - Survey, + Questionnaire, Crew, Budget, Bookkeeping, @@ -417,8 +417,8 @@ defmodule Systems.Campaign.Public do |> Repo.all() end - def list_survey_tools(%Campaign.Model{} = campaign) do - from(s in Survey.ToolModel, where: s.campaign_id == ^campaign.id) + def list_questionnaire_tools(%Campaign.Model{} = campaign) do + from(s in Questionnaire.ToolModel, where: s.campaign_id == ^campaign.id) |> Repo.all() end diff --git a/core/systems/campaign/_switch.ex b/core/systems/campaign/_switch.ex index 9ea13e0ae..f3b710e92 100644 --- a/core/systems/campaign/_switch.ex +++ b/core/systems/campaign/_switch.ex @@ -13,8 +13,8 @@ defmodule Systems.Campaign.Switch do handle(signal, object) end - def handle(:survey_tool_updated, survey_tool) do - experiment = Assignment.Public.get_experiment_by_tool(survey_tool) + def handle(:questionnaire_tool_updated, questionnaire_tool) do + experiment = Assignment.Public.get_experiment_by_tool(questionnaire_tool) handle(:experiment_updated, experiment) end diff --git a/core/systems/campaign/builders/assignment_callback_page.ex b/core/systems/campaign/builders/assignment_callback_page.ex index e9809643e..5b3e84264 100644 --- a/core/systems/campaign/builders/assignment_callback_page.ex +++ b/core/systems/campaign/builders/assignment_callback_page.ex @@ -33,7 +33,7 @@ defmodule Systems.Campaign.Builders.AssignmentCallbackPage do id: id, title: title, state: state(assignment, user), - hero_title: dgettext("link-survey", "task.hero.title"), + hero_title: dgettext("link-questionnaire", "task.hero.title"), call_to_action: forward_call_to_action(user) } end diff --git a/core/systems/campaign/builders/assignment_landing_page.ex b/core/systems/campaign/builders/assignment_landing_page.ex index 07ab51ea7..74d3878a2 100644 --- a/core/systems/campaign/builders/assignment_landing_page.ex +++ b/core/systems/campaign/builders/assignment_landing_page.ex @@ -12,7 +12,7 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do Campaign, Assignment, Crew, - Survey, + Questionnaire, Lab, Budget } @@ -48,7 +48,7 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do id: id, title: title, highlights: highlights(assignment, reward), - hero_title: dgettext("link-survey", "task.hero.title") + hero_title: dgettext("link-questionnaire", "task.hero.title") } extra = @@ -78,28 +78,29 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do # Subtitle defp assignment_subtitle(%{status: :pending}), - do: dgettext("link-survey", "task.pending.subtitle") + do: dgettext("link-questionnaire", "task.pending.subtitle") defp assignment_subtitle(%{status: :completed}), - do: dgettext("link-survey", "task.completed.subtitle") + do: dgettext("link-questionnaire", "task.completed.subtitle") defp assignment_subtitle(%{status: :accepted}), - do: dgettext("link-survey", "task.accepted.subtitle") + do: dgettext("link-questionnaire", "task.accepted.subtitle") defp assignment_subtitle(%{status: :rejected}), - do: dgettext("link-survey", "task.rejected.subtitle") + do: dgettext("link-questionnaire", "task.rejected.subtitle") defp assignment_subtitle(_), do: dgettext("eyra-promotion", "expectations.public.label") # Text defp assignment_text(%{status: :completed}, _), - do: dgettext("link-survey", "task.completed.text") + do: dgettext("link-questionnaire", "task.completed.text") - defp assignment_text(%{status: :accepted}, _), do: dgettext("link-survey", "task.accepted.text") + defp assignment_text(%{status: :accepted}, _), + do: dgettext("link-questionnaire", "task.accepted.text") defp assignment_text(%{status: :rejected, rejected_message: rejected_message}, _) do - dgettext("link-survey", "task.rejected.text", reason: rejected_message) + dgettext("link-questionnaire", "task.rejected.text", reason: rejected_message) end defp assignment_text(_, expectations), do: expectations @@ -120,19 +121,19 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do # Experiment defp experiment( - %{assignable_experiment: %{survey_tool: survey_tool}} = assignment, + %{assignable_experiment: %{questionnaire_tool: questionnaire_tool}} = assignment, member, user, task, contact, title ) - when not is_nil(survey_tool) do - actions = survey_actions(assignment, member, user, task, contact, title) + when not is_nil(questionnaire_tool) do + actions = questionnaire_actions(assignment, member, user, task, contact, title) %{ id: :experiment_task_view, - view: Survey.ExperimentTaskView, + view: Questionnaire.ExperimentTaskView, model: %{ actions: actions } @@ -167,15 +168,15 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do defp experiment(_assignment, _member, _user, _task, _contact, _title), do: nil - # Survey buttons + # Questionnaire buttons - defp survey_actions(assignment, member, user, task, contact, title) do + defp questionnaire_actions(assignment, member, user, task, contact, title) do [] - |> append(survey_cta(assignment, member, user)) + |> append(questionnaire_cta(assignment, member, user)) |> append_if(contact_enabled?(task), contact_action(contact, member, title)) end - defp survey_cta( + defp questionnaire_cta( %{crew: crew, assignable_experiment: experiment} = _assignment, member, user @@ -192,7 +193,7 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do end end - # Survey forward button + # Questionnaire forward button defp forward_action(user) do %{ @@ -209,7 +210,7 @@ defmodule Systems.Campaign.Builders.AssignmentLandingPage do Phoenix.LiveView.push_redirect(socket, to: Accounts.start_page_path(user)) end - # Survey open button + # Questionnaire open button defp open_action(user, experiment, crew, panl_id) do label = Assignment.ExperimentModel.open_label(experiment) diff --git a/core/systems/campaign/builders/campaign_content_page.ex b/core/systems/campaign/builders/campaign_content_page.ex index 65931406e..6943dc021 100644 --- a/core/systems/campaign/builders/campaign_content_page.ex +++ b/core/systems/campaign/builders/campaign_content_page.ex @@ -83,8 +83,8 @@ defmodule Systems.Campaign.Builders.CampaignContentPage do id: :promotion_form, ready: ready?, show_errors: show_errors, - title: dgettext("link-survey", "tabbar.item.promotion"), - forward_title: dgettext("link-survey", "tabbar.item.promotion.forward"), + title: dgettext("link-questionnaire", "tabbar.item.promotion"), + forward_title: dgettext("link-questionnaire", "tabbar.item.promotion.forward"), type: :fullpage, live_component: Promotion.FormView, props: %{ @@ -108,8 +108,8 @@ defmodule Systems.Campaign.Builders.CampaignContentPage do id: :assignment_form, ready: ready?, show_errors: show_errors, - title: dgettext("link-survey", "tabbar.item.assignment"), - forward_title: dgettext("link-survey", "tabbar.item.assignment.forward"), + title: dgettext("link-questionnaire", "tabbar.item.assignment"), + forward_title: dgettext("link-questionnaire", "tabbar.item.assignment.forward"), type: :fullpage, live_component: Assignment.AssignmentForm, props: %{ @@ -131,8 +131,8 @@ defmodule Systems.Campaign.Builders.CampaignContentPage do ) do %{ id: :submission_form, - title: dgettext("link-survey", "tabbar.item.submission"), - forward_title: dgettext("link-survey", "tabbar.item.submission.forward"), + title: dgettext("link-questionnaire", "tabbar.item.submission"), + forward_title: dgettext("link-questionnaire", "tabbar.item.submission.forward"), type: :fullpage, live_component: Pool.CampaignSubmissionView, props: %{ @@ -152,8 +152,8 @@ defmodule Systems.Campaign.Builders.CampaignContentPage do ) do %{ id: :funding, - title: dgettext("link-survey", "tabbar.item.funding"), - forward_title: dgettext("link-survey", "tabbar.item.funding.forward"), + title: dgettext("link-questionnaire", "tabbar.item.funding"), + forward_title: dgettext("link-questionnaire", "tabbar.item.funding.forward"), type: :fullpage, live_component: Campaign.FundingView, props: %{ @@ -178,8 +178,8 @@ defmodule Systems.Campaign.Builders.CampaignContentPage do %{ id: :monitor, - title: dgettext("link-survey", "tabbar.item.monitor"), - forward_title: dgettext("link-survey", "tabbar.item.monitor.forward"), + title: dgettext("link-questionnaire", "tabbar.item.monitor"), + forward_title: dgettext("link-questionnaire", "tabbar.item.monitor.forward"), type: :fullpage, live_component: Campaign.MonitorView, props: %{ diff --git a/core/systems/campaign/builders/highlight.ex b/core/systems/campaign/builders/highlight.ex index 3f9ff7bcd..0e144efd0 100644 --- a/core/systems/campaign/builders/highlight.ex +++ b/core/systems/campaign/builders/highlight.ex @@ -8,7 +8,7 @@ defmodule Systems.Campaign.Builders.Highlight do } defp vm(%Budget.CurrencyModel{} = currency, amount, :reward) do - reward_title = dgettext("link-survey", "reward.highlight.title") + reward_title = dgettext("link-questionnaire", "reward.highlight.title") locale = Gettext.get_locale(CoreWeb.Gettext) reward_text = Budget.CurrencyModel.label(currency, locale, amount) %{title: reward_title, text: reward_text} @@ -28,28 +28,28 @@ defmodule Systems.Campaign.Builders.Highlight do def view_model(%Assignment.Model{assignable_experiment: experiment}, :duration) do duration = Assignment.ExperimentModel.duration(experiment) - duration_title = dgettext("link-survey", "duration.highlight.title") - duration_text = dgettext("link-survey", "duration.highlight.text", duration: duration) + duration_title = dgettext("link-questionnaire", "duration.highlight.title") + duration_text = dgettext("link-questionnaire", "duration.highlight.text", duration: duration) %{title: duration_title, text: duration_text} end def view_model(%Assignment.Model{} = assignment, :status) do has_open_spots? = Assignment.Public.has_open_spots?(assignment) - status_title = dgettext("link-survey", "status.highlight.title") + status_title = dgettext("link-questionnaire", "status.highlight.title") status_text = if has_open_spots? do - dgettext("link-survey", "status.open.highlight.text") + dgettext("link-questionnaire", "status.open.highlight.text") else - dgettext("link-survey", "status.closed.highlight.text") + dgettext("link-questionnaire", "status.closed.highlight.text") end %{title: status_title, text: status_text} end def view_model(%Assignment.Model{assignable_experiment: experiment}, :language) do - language_title = dgettext("link-survey", "language.highlight.title") + language_title = dgettext("link-questionnaire", "language.highlight.title") language_text = Assignment.ExperimentModel.languages(experiment) diff --git a/core/systems/campaign/builders/promotion_landing_page.ex b/core/systems/campaign/builders/promotion_landing_page.ex index 597186245..a8f5cff4c 100644 --- a/core/systems/campaign/builders/promotion_landing_page.ex +++ b/core/systems/campaign/builders/promotion_landing_page.ex @@ -49,7 +49,7 @@ defmodule Systems.Campaign.Builders.PromotionLandingPage do end defp byline(authors) when is_list(authors) do - "#{dgettext("link-survey", "by.author.label")}: " <> + "#{dgettext("link-questionnaire", "by.author.label")}: " <> Enum.map_join(authors, ", ", & &1.fullname) end diff --git a/core/systems/campaign/content_page.ex b/core/systems/campaign/content_page.ex index 684b7b7c4..946340a54 100644 --- a/core/systems/campaign/content_page.ex +++ b/core/systems/campaign/content_page.ex @@ -446,9 +446,9 @@ defmodule Systems.Campaign.ContentPage do @impl true def render(assigns) do ~H""" - <.workspace title={dgettext("link-survey", "content.title")} menus={@menus}> + <.workspace title={dgettext("link-questionnaire", "content.title")} menus={@menus}>
-
+
<%= if @popup do %> <.popup> diff --git a/core/systems/campaign/monitor_view.ex b/core/systems/campaign/monitor_view.ex index 77e6775c0..ec668e031 100644 --- a/core/systems/campaign/monitor_view.ex +++ b/core/systems/campaign/monitor_view.ex @@ -150,8 +150,8 @@ defmodule Systems.Campaign.MonitorView do <%= if not @vm.active? do %> <.empty - title={dgettext("link-survey", "monitor.empty.title")} - body={dgettext("link-survey", "monitor.empty.description")} + title={dgettext("link-questionnaire", "monitor.empty.title")} + body={dgettext("link-questionnaire", "monitor.empty.description")} illustration="members" /> <% else %> @@ -165,7 +165,7 @@ defmodule Systems.Campaign.MonitorView do <% end %> <%= dgettext("link-monitor", "phase1.title") %> - <%= dgettext("link-survey", "status.title") %> + <%= dgettext("link-questionnaire", "status.title") %> <%= @vm.participated_count %>/<%= @vm.progress.size %> <.spacing value="M" />
@@ -186,7 +186,7 @@ defmodule Systems.Campaign.MonitorView do
- <%= dgettext("link-survey", "vacant.label") %>: <%= @vm.vacant_count %> + <%= dgettext("link-questionnaire", "vacant.label") %>: <%= @vm.vacant_count %>
diff --git a/core/systems/campaign/overview_page.ex b/core/systems/campaign/overview_page.ex index a67cb6601..9ce1f2083 100644 --- a/core/systems/campaign/overview_page.ex +++ b/core/systems/campaign/overview_page.ex @@ -213,7 +213,7 @@ defmodule Systems.Campaign.OverviewPage do @impl true def render(assigns) do ~H""" - <.workspace title={dgettext("link-survey", "title")} menus={@menus}> + <.workspace title={dgettext("link-questionnaire", "title")} menus={@menus}> <%= if @popup do %> <.popup> @@ -244,17 +244,17 @@ defmodule Systems.Campaign.OverviewPage do <%= if Enum.count(@campaigns) > 0 do %>
- <%= dgettext("link-survey", "campaign.overview.title") %> + <%= dgettext("link-questionnaire", "campaign.overview.title") %>
- +
@@ -268,13 +268,13 @@ defmodule Systems.Campaign.OverviewPage do <.spacing value="L" /> <% else %> <.empty - title={dgettext("link-survey", "empty.title")} - body={dgettext("link-survey", "empty.description")} + title={dgettext("link-questionnaire", "empty.title")} + body={dgettext("link-questionnaire", "empty.description")} illustration="cards" /> <.spacing value="L" /> <% end %> diff --git a/core/systems/data_donation/_public.ex b/core/systems/data_donation/_public.ex index 754615587..cdc2e9ea2 100644 --- a/core/systems/data_donation/_public.ex +++ b/core/systems/data_donation/_public.ex @@ -116,9 +116,9 @@ defmodule Systems.DataDonation.Public do |> Ecto.Changeset.put_assoc(task_type, special) end - def create_task_special(:survey_task) do - %DataDonation.SurveyTaskModel{} - |> DataDonation.SurveyTaskModel.changeset(%{}) + def create_task_special(:questionnaire_task) do + %DataDonation.QuestionnaireTaskModel{} + |> DataDonation.QuestionnaireTaskModel.changeset(%{}) end def create_task_special(:request_task) do diff --git a/core/systems/data_donation/document_task_form.ex b/core/systems/data_donation/document_task_form.ex index bd2f140fe..8ae05aa68 100644 --- a/core/systems/data_donation/document_task_form.ex +++ b/core/systems/data_donation/document_task_form.ex @@ -23,6 +23,7 @@ defmodule Systems.DataDonation.DocumentTaskForm do }, socket ) do + label = dgettext("eyra-data-donation", "pdf-select-label") placeholder = dgettext("eyra-data-donation", "pdf-select-placeholder") select_button = dgettext("eyra-data-donation", "pdf-select-file-button") replace_button = dgettext("eyra-data-donation", "pdf-replace-file-button") @@ -32,6 +33,7 @@ defmodule Systems.DataDonation.DocumentTaskForm do socket |> assign( id: id, + label: label, placeholder: placeholder, select_button: select_button, replace_button: replace_button, @@ -59,7 +61,7 @@ defmodule Systems.DataDonation.DocumentTaskForm do ~H"""
<.form id="select_file_form" for={%{}} phx-change="change" phx-target="" > - <%= @placeholder %> + <%= @label %> <.spacing value="XXS" />
diff --git a/core/systems/data_donation/survey_task_model.ex b/core/systems/data_donation/questionnaire_task_model.ex similarity index 79% rename from core/systems/data_donation/survey_task_model.ex rename to core/systems/data_donation/questionnaire_task_model.ex index f2af33ef1..e98b87473 100644 --- a/core/systems/data_donation/survey_task_model.ex +++ b/core/systems/data_donation/questionnaire_task_model.ex @@ -1,8 +1,8 @@ -defmodule Systems.DataDonation.SurveyTaskModel do +defmodule Systems.DataDonation.QuestionnaireTaskModel do use Ecto.Schema import Ecto.Changeset - schema "data_donation_survey_tasks" do + schema "data_donation_questionnaire_tasks" do timestamps() end diff --git a/core/systems/data_donation/task_cell.ex b/core/systems/data_donation/task_cell.ex index 3cfb76915..6edad0954 100644 --- a/core/systems/data_donation/task_cell.ex +++ b/core/systems/data_donation/task_cell.ex @@ -119,8 +119,8 @@ defmodule Systems.DataDonation.TaskCell do ) end - defp get_title(%{survey_task_id: id}) when not is_nil(id), - do: dgettext("eyra-data-donation", "task.survey.title") + defp get_title(%{questionnaire_task_id: id}) when not is_nil(id), + do: dgettext("eyra-data-donation", "task.questionnaire.title") defp get_title(%{request_task_id: id}) when not is_nil(id), do: dgettext("eyra-data-donation", "task.request.title") diff --git a/core/systems/data_donation/task_model.ex b/core/systems/data_donation/task_model.ex index b8a739ee7..4ebd03808 100644 --- a/core/systems/data_donation/task_model.ex +++ b/core/systems/data_donation/task_model.ex @@ -17,7 +17,7 @@ defmodule Systems.DataDonation.TaskModel do belongs_to(:tool, DataDonation.ToolModel) has_many(:statuses, DataDonation.TaskSpotStatusModel, foreign_key: :task_id) - belongs_to(:survey_task, DataDonation.SurveyTaskModel) + belongs_to(:questionnaire_task, DataDonation.QuestionnaireTaskModel) belongs_to(:request_task, DataDonation.DocumentTaskModel) belongs_to(:download_task, DataDonation.DocumentTaskModel) belongs_to(:donate_task, DataDonation.DonateTaskModel) @@ -54,8 +54,8 @@ defmodule Systems.DataDonation.TaskModel do end end - def ready?(%DataDonation.SurveyTaskModel{} = special), - do: DataDonation.SurveyTaskModel.ready?(special) + def ready?(%DataDonation.QuestionnaireTaskModel{} = special), + do: DataDonation.QuestionnaireTaskModel.ready?(special) def ready?(%DataDonation.DocumentTaskModel{} = special), do: DataDonation.DocumentTaskModel.ready?(special) @@ -70,7 +70,7 @@ defmodule Systems.DataDonation.TaskModel do ]) end - defp special(%{survey_task: %{id: _id} = special}), do: special + defp special(%{questionnaire_task: %{id: _id} = special}), do: special defp special(%{request_task: %{id: _id} = special}), do: special defp special(%{download_task: %{id: _id} = special}), do: special defp special(%{donate_task: %{id: _id} = special}), do: special @@ -78,13 +78,13 @@ defmodule Systems.DataDonation.TaskModel do def preload_graph(:down), do: preload_graph([ - :survey_task, + :questionnaire_task, :request_task, :download_task, :donate_task ]) - def preload_graph(:survey_task), do: [survey_task: []] + def preload_graph(:questionnaire_task), do: [questionnaire_task: []] def preload_graph(:request_task), do: [request_task: []] def preload_graph(:download_task), do: [download_task: []] def preload_graph(:donate_task), do: [donate_task: []] diff --git a/core/systems/data_donation/task_views.ex b/core/systems/data_donation/task_views.ex index bfdc03870..48dc6f04e 100644 --- a/core/systems/data_donation/task_views.ex +++ b/core/systems/data_donation/task_views.ex @@ -38,7 +38,7 @@ defmodule Systems.DataDonation.TaskViews do <.spacing value="M" /> <.wrap> diff --git a/core/systems/project/_switch.ex b/core/systems/project/_switch.ex index 1eb24fe5a..fdabbe628 100644 --- a/core/systems/project/_switch.ex +++ b/core/systems/project/_switch.ex @@ -32,9 +32,9 @@ defmodule Systems.Project.Switch do end @impl true - def dispatch(:data_donation_survey_task, %{changeset: changeset}) do + def dispatch(:data_donation_questionnaire_task, %{changeset: changeset}) do special_id = Ecto.Changeset.get_field(changeset, :id) - task = DataDonation.Public.get_task_by_special!(:survey_task_id, special_id) + task = DataDonation.Public.get_task_by_special!(:questionnaire_task_id, special_id) update_pages(task) end diff --git a/core/systems/project/content_page_builder/item_data_donation.ex b/core/systems/project/content_page_builder/item_data_donation.ex index 6510b21ea..9fcc70cdf 100644 --- a/core/systems/project/content_page_builder/item_data_donation.ex +++ b/core/systems/project/content_page_builder/item_data_donation.ex @@ -153,9 +153,9 @@ defmodule Systems.Project.ContentPageBuilder.ItemDataDonation do description: dgettext("eyra-data-donation", "task.library.description"), items: [ %{ - id: :survey, - title: dgettext("eyra-data-donation", "task.survey.title"), - description: dgettext("eyra-data-donation", "task.survey.description") + id: :questionnaire, + title: dgettext("eyra-data-donation", "task.questionnaire.title"), + description: dgettext("eyra-data-donation", "task.questionnaire.description") }, %{ id: :request, diff --git a/core/systems/project/item_content_page.ex b/core/systems/project/item_content_page.ex index 49913c748..bdea689ea 100644 --- a/core/systems/project/item_content_page.ex +++ b/core/systems/project/item_content_page.ex @@ -291,7 +291,7 @@ defmodule Systems.Project.ItemContentPage do
-
+
<%= if @popup do %> <.popup> diff --git a/core/systems/project/tool_ref_model.ex b/core/systems/project/tool_ref_model.ex index b1524d8bd..48846037b 100644 --- a/core/systems/project/tool_ref_model.ex +++ b/core/systems/project/tool_ref_model.ex @@ -6,7 +6,7 @@ defmodule Systems.Project.ToolRefModel do alias Systems.{ Project, - Survey, + Questionnaire, Lab, DataDonation, Benchmark @@ -14,7 +14,7 @@ defmodule Systems.Project.ToolRefModel do schema "tool_refs" do has_one(:item, Project.ItemModel, foreign_key: :tool_ref_id) - belongs_to(:survey_tool, Survey.ToolModel) + belongs_to(:questionnaire_tool, Questionnaire.ToolModel) belongs_to(:lab_tool, Lab.ToolModel) belongs_to(:data_donation_tool, DataDonation.ToolModel) belongs_to(:benchmark_tool, Benchmark.ToolModel) @@ -34,13 +34,15 @@ defmodule Systems.Project.ToolRefModel do def preload_graph(:down), do: preload_graph([ - :survey_tool, + :questionnaire_tool, :lab_tool, :data_donation_tool, :benchmark_tool ]) - def preload_graph(:survey_tool), do: [survey_tool: Survey.ToolModel.preload_graph(:full)] + def preload_graph(:questionnaire_tool), + do: [questionnaire_tool: Questionnaire.ToolModel.preload_graph(:full)] + def preload_graph(:lab_tool), do: [lab_tool: Lab.ToolModel.preload_graph(:full)] def preload_graph(:data_donation_tool), diff --git a/core/systems/questionnaire/_public.ex b/core/systems/questionnaire/_public.ex new file mode 100644 index 000000000..a51abfc27 --- /dev/null +++ b/core/systems/questionnaire/_public.ex @@ -0,0 +1,134 @@ +defmodule Systems.Questionnaire.Public do + @moduledoc """ + + Questionnaire tools allow a researcher to setup a link to an external questionnaire + tool. The participant goes through the flow described below: + + - Receive invitation to start a questionnaire (mail, push etc.). + - Open questionnaire tool, this opens it on the platform and requires authentication. + - The participant is then redirected to the questionnaire at a 3rd party web-application. + - After completion the user is redirect back to the platform. + - The platform registers the completion of this questionnaire for the participant. + + + A researcher is required to configure the 3rd party application with a redirect + link. The redirect link to be used is show on the questionnaire tool configuration + screen (with copy button). + + IDEA: The tool requires a sucessful round-trip with a verify flow to ensure + that everything is configured correctly. + + Participants need to be invited to a particular questionnaire explicitly. This avoids + the situation where a new user joins a study and then can immediately complete + previous questionnaires. + + Once a participant has completed a questionnaire they are no longer allowed to enter it + a second time. The status is clearly shown when the attempt to do so. + + IDEA: A list of questionnaires can be access by the notification icon which is shown + on all screens. + """ + + import Ecto.Query, warn: false + alias Ecto.Multi + alias Core.Repo + + alias Frameworks.{ + Signal + } + + alias Systems.{ + Questionnaire + } + + @doc """ + Returns the list of questionnaire_tools. + """ + def list_questionnaire_tools do + Repo.all(Questionnaire.ToolModel) + end + + @doc """ + Gets a single questionnaire_tool. + + Raises `Ecto.NoResultsError` if the Questionnaire tool does not exist. + """ + def get_questionnaire_tool!(id), do: Repo.get!(Questionnaire.ToolModel, id) + def get_questionnaire_tool(id), do: Repo.get(Questionnaire.ToolModel, id) + + @doc """ + Creates a questionnaire_tool. + """ + def create_tool(attrs, auth_node) do + %Questionnaire.ToolModel{} + |> Questionnaire.ToolModel.changeset(:mount, attrs) + |> Ecto.Changeset.put_assoc(:auth_node, auth_node) + |> Repo.insert() + end + + @doc """ + Updates a questionnaire_tool. + """ + def update_questionnaire_tool(%Questionnaire.ToolModel{} = questionnaire_tool, type, attrs) do + questionnaire_tool + |> Questionnaire.ToolModel.changeset(type, attrs) + |> update_questionnaire_tool() + end + + def update_questionnaire_tool(_, _, _), do: {:error, nil} + + def update_questionnaire_tool(changeset) do + result = + Multi.new() + |> Repo.multi_update(:tool, changeset) + |> Repo.transaction() + + with {:ok, %{tool: tool}} <- result do + Signal.Public.dispatch!(:questionnaire_tool_updated, tool) + end + + result + end + + @doc """ + Deletes a questionnaire_tool. + """ + def delete_questionnaire_tool(%Questionnaire.ToolModel{} = questionnaire_tool) do + Repo.delete(questionnaire_tool) + end + + @doc """ + Returns an `%Ecto.Changeset{}` for tracking questionnaire_tool changes. + """ + def change_questionnaire_tool( + %Questionnaire.ToolModel{} = questionnaire_tool, + type, + attrs \\ %{} + ) do + Questionnaire.ToolModel.changeset(questionnaire_tool, type, attrs) + end + + def copy(%Questionnaire.ToolModel{} = tool, auth_node) do + %Questionnaire.ToolModel{} + |> Questionnaire.ToolModel.changeset(:copy, Map.from_struct(tool)) + |> Ecto.Changeset.put_assoc(:auth_node, auth_node) + |> Repo.insert!() + end + + def ready?(%Questionnaire.ToolModel{} = questionnaire_tool) do + changeset = + %Questionnaire.ToolModel{} + |> Questionnaire.ToolModel.operational_changeset(Map.from_struct(questionnaire_tool)) + + changeset.valid? + end +end + +defimpl Core.Persister, for: Systems.Questionnaire.ToolModel do + def save(_tool, changeset) do + case Systems.Questionnaire.Public.update_questionnaire_tool(changeset) do + {:ok, %{tool: tool}} -> {:ok, tool} + _ -> {:error, changeset} + end + end +end diff --git a/core/systems/survey/experiment_task_view.ex b/core/systems/questionnaire/experiment_task_view.ex similarity index 91% rename from core/systems/survey/experiment_task_view.ex rename to core/systems/questionnaire/experiment_task_view.ex index 4002c81a3..a45cbe705 100644 --- a/core/systems/survey/experiment_task_view.ex +++ b/core/systems/questionnaire/experiment_task_view.ex @@ -1,4 +1,4 @@ -defmodule Systems.Survey.ExperimentTaskView do +defmodule Systems.Questionnaire.ExperimentTaskView do use CoreWeb, :live_component alias Frameworks.Utility.LiveCommand diff --git a/core/systems/survey/tool_form.ex b/core/systems/questionnaire/tool_form.ex similarity index 73% rename from core/systems/survey/tool_form.ex rename to core/systems/questionnaire/tool_form.ex index 379c3eef0..1d76a5291 100644 --- a/core/systems/survey/tool_form.ex +++ b/core/systems/questionnaire/tool_form.ex @@ -1,4 +1,4 @@ -defmodule Systems.Survey.ToolForm do +defmodule Systems.Questionnaire.ToolForm do use CoreWeb.LiveForm import CoreWeb.UI.StepIndicator @@ -11,7 +11,7 @@ defmodule Systems.Survey.ToolForm do alias Systems.{ Director, - Survey + Questionnaire } # Handle initial update @@ -25,9 +25,9 @@ defmodule Systems.Survey.ToolForm do }, socket ) do - entity = Survey.Public.get_survey_tool!(entity_id) + entity = Questionnaire.Public.get_questionnaire_tool!(entity_id) - changeset = Survey.ToolModel.changeset(entity, :create, %{}) + changeset = Questionnaire.ToolModel.changeset(entity, :create, %{}) { :ok, @@ -52,13 +52,13 @@ defmodule Systems.Survey.ToolForm do _params, %{assigns: %{user: user, changeset: changeset, entity: entity}} = socket ) do - changeset = Survey.ToolModel.validate(changeset, :roundtrip) + changeset = Questionnaire.ToolModel.validate(changeset, :roundtrip) if changeset.valid? do Director.public(entity).assign_tester_role(entity, user) fake_panl_id = "TEST-" <> Faker.UUID.v4() - external_path = Survey.ToolModel.external_path(entity, fake_panl_id) + external_path = Questionnaire.ToolModel.external_path(entity, fake_panl_id) {:noreply, LiveView.redirect(socket, external: external_path)} else @@ -78,7 +78,7 @@ defmodule Systems.Survey.ToolForm do # Saving def save(socket, entity, type, attrs) do - changeset = Survey.ToolModel.changeset(entity, type, attrs) + changeset = Questionnaire.ToolModel.changeset(entity, type, attrs) socket |> save(changeset) @@ -89,7 +89,7 @@ defmodule Systems.Survey.ToolForm do def validate_for_publish(%{assigns: %{id: id, entity: entity}} = socket) do changeset = - Survey.ToolModel.operational_changeset(entity, %{}) + Questionnaire.ToolModel.operational_changeset(entity, %{}) |> Map.put(:action, :validate_for_publish) send(self(), %{id: id, ready?: changeset.valid?}) @@ -100,21 +100,21 @@ defmodule Systems.Survey.ToolForm do defp redirect_instructions_link() do link_as_string( - dgettext("link-survey", "redirect.instructions.link"), + dgettext("link-questionnaire", "redirect.instructions.link"), "https://www.qualtrics.com/support/survey-platform/survey-module/survey-options/survey-termination/#RedirectingRespondentsToAUrl" ) end defp panlid_instructions_link() do link_as_string( - dgettext("link-survey", "panlid.instructions.link"), - "https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/passing-information-through-query-strings/?parent=p001135#PassingInformationIntoASurvey" + dgettext("link-questionnaire", "panlid.instructions.link"), + "https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/passing-information-through-query-strings/?parent=p001135#PassingInformationIntoAQuestionnaire" ) end defp study_instructions_link() do link_as_string( - dgettext("link-survey", "study.instructions.link"), + dgettext("link-questionnaire", "study.instructions.link"), "https://www.qualtrics.com/support/survey-platform/distributions-module/web-distribution/anonymous-link/#ObtainingTheAnonymousLink" ) end @@ -134,12 +134,12 @@ defmodule Systems.Survey.ToolForm do ~H"""
<.form id={@id} :let={form} for={@changeset} phx-change="save" phx-target={@myself}> - <%= dgettext("link-survey", "form.title") %> - <%= dgettext("link-survey", "form.description") %> + <%= dgettext("link-questionnaire", "form.title") %> + <%= dgettext("link-questionnaire", "form.description") %> <.spacing value="M" /> - <%= dgettext("link-survey", "setup.title") %> + <%= dgettext("link-questionnaire", "setup.title") %> <.spacing value="M" />
@@ -148,9 +148,9 @@ defmodule Systems.Survey.ToolForm do <.step_indicator text="1" bg_color="bg-tertiary" text_color="text-grey1" />
- <%= dgettext("link-survey", "panlid.title") %> + <%= dgettext("link-questionnaire", "panlid.title") %> <.spacing value="XS" /> - <%= raw(dgettext("link-survey", "panlid.description", link: panlid_instructions_link())) %> + <%= raw(dgettext("link-questionnaire", "panlid.description", link: panlid_instructions_link())) %>
@@ -159,9 +159,9 @@ defmodule Systems.Survey.ToolForm do <.step_indicator text="2" bg_color="bg-tertiary" text_color="text-grey1" />
- <%= dgettext("link-survey", "redirect.title") %> + <%= dgettext("link-questionnaire", "redirect.title") %> <.spacing value="XS" /> - <%= raw(dgettext("link-survey", "redirect.description", link: redirect_instructions_link())) %> + <%= raw(dgettext("link-questionnaire", "redirect.description", link: redirect_instructions_link())) %> <.spacing value="XS" />
@@ -170,7 +170,7 @@ defmodule Systems.Survey.ToolForm do
@@ -185,9 +185,9 @@ defmodule Systems.Survey.ToolForm do <.step_indicator text="3" bg_color="bg-tertiary" text_color="text-grey1" />
- <%= dgettext("link-survey", "study.link.title") %> + <%= dgettext("link-questionnaire", "study.link.title") %> <.spacing value="XS" /> - <%= raw(dgettext("link-survey", "study.link.description", link: study_instructions_link())) %> + <%= raw(dgettext("link-questionnaire", "study.link.description", link: study_instructions_link())) %>
@@ -195,19 +195,19 @@ defmodule Systems.Survey.ToolForm do <.spacing value="L" /> - <.url_input form={form} field={:survey_url} label_text={dgettext("link-survey", "config.url.label")} /> + <.url_input form={form} field={:questionnaire_url} label_text={dgettext("link-questionnaire", "config.url.label")} /> <.spacing value="S" /> - <%= dgettext("link-survey", "test.roundtrip.title") %> + <%= dgettext("link-questionnaire", "test.roundtrip.title") %> <.spacing value="M" /> - <%= dgettext("link-survey", "test.roundtrip.text") %> + <%= dgettext("link-questionnaire", "test.roundtrip.text") %> <.spacing value="M" /> <.wrap> cast(params, @fields) |> validate_required(@required_fields) - |> validate_url(:survey_url) + |> validate_url(:questionnaire_url) end def changeset(tool, _, params) do @@ -59,7 +59,7 @@ defmodule Systems.Survey.ToolModel do def validate(changeset, :roundtrip) do changeset = changeset - |> Ecto.Changeset.validate_required([:survey_url]) + |> Ecto.Changeset.validate_required([:questionnaire_url]) %{changeset | action: :validate_roundtrip} end @@ -126,8 +126,9 @@ defmodule Systems.Survey.ToolModel do |> to_string() end - def external_path(%{survey_url: survey_url}, panl_id) when not is_nil(survey_url) do - url_components = URI.parse(survey_url) + def external_path(%{questionnaire_url: questionnaire_url}, panl_id) + when not is_nil(questionnaire_url) do + url_components = URI.parse(questionnaire_url) query = url_components.query diff --git a/core/systems/survey/_public.ex b/core/systems/survey/_public.ex deleted file mode 100644 index a87793407..000000000 --- a/core/systems/survey/_public.ex +++ /dev/null @@ -1,130 +0,0 @@ -defmodule Systems.Survey.Public do - @moduledoc """ - - Survey tools allow a researcher to setup a link to an external survey - tool. The participant goes through the flow described below: - - - Receive invitation to start a survey (mail, push etc.). - - Open survey tool, this opens it on the platform and requires authentication. - - The participant is then redirected to the survey at a 3rd party web-application. - - After completion the user is redirect back to the platform. - - The platform registers the completion of this survey for the participant. - - - A researcher is required to configure the 3rd party application with a redirect - link. The redirect link to be used is show on the survey tool configuration - screen (with copy button). - - IDEA: The tool requires a sucessful round-trip with a verify flow to ensure - that everything is configured correctly. - - Participants need to be invited to a particular survey explicitly. This avoids - the situation where a new user joins a study and then can immediately complete - previous surveys. - - Once a participant has completed a survey they are no longer allowed to enter it - a second time. The status is clearly shown when the attempt to do so. - - IDEA: A list of surveys can be access by the notification icon which is shown - on all screens. - """ - - import Ecto.Query, warn: false - alias Ecto.Multi - alias Core.Repo - - alias Frameworks.{ - Signal - } - - alias Systems.{ - Survey - } - - @doc """ - Returns the list of survey_tools. - """ - def list_survey_tools do - Repo.all(Survey.ToolModel) - end - - @doc """ - Gets a single survey_tool. - - Raises `Ecto.NoResultsError` if the Survey tool does not exist. - """ - def get_survey_tool!(id), do: Repo.get!(Survey.ToolModel, id) - def get_survey_tool(id), do: Repo.get(Survey.ToolModel, id) - - @doc """ - Creates a survey_tool. - """ - def create_tool(attrs, auth_node) do - %Survey.ToolModel{} - |> Survey.ToolModel.changeset(:mount, attrs) - |> Ecto.Changeset.put_assoc(:auth_node, auth_node) - |> Repo.insert() - end - - @doc """ - Updates a survey_tool. - """ - def update_survey_tool(%Survey.ToolModel{} = survey_tool, type, attrs) do - survey_tool - |> Survey.ToolModel.changeset(type, attrs) - |> update_survey_tool() - end - - def update_survey_tool(_, _, _), do: {:error, nil} - - def update_survey_tool(changeset) do - result = - Multi.new() - |> Repo.multi_update(:tool, changeset) - |> Repo.transaction() - - with {:ok, %{tool: tool}} <- result do - Signal.Public.dispatch!(:survey_tool_updated, tool) - end - - result - end - - @doc """ - Deletes a survey_tool. - """ - def delete_survey_tool(%Survey.ToolModel{} = survey_tool) do - Repo.delete(survey_tool) - end - - @doc """ - Returns an `%Ecto.Changeset{}` for tracking survey_tool changes. - """ - def change_survey_tool(%Survey.ToolModel{} = survey_tool, type, attrs \\ %{}) do - Survey.ToolModel.changeset(survey_tool, type, attrs) - end - - def copy(%Survey.ToolModel{} = tool, auth_node) do - %Survey.ToolModel{} - |> Survey.ToolModel.changeset(:copy, Map.from_struct(tool)) - |> Ecto.Changeset.put_assoc(:auth_node, auth_node) - |> Repo.insert!() - end - - def ready?(%Survey.ToolModel{} = survey_tool) do - changeset = - %Survey.ToolModel{} - |> Survey.ToolModel.operational_changeset(Map.from_struct(survey_tool)) - - changeset.valid? - end -end - -defimpl Core.Persister, for: Systems.Survey.ToolModel do - def save(_tool, changeset) do - case Systems.Survey.Public.update_survey_tool(changeset) do - {:ok, %{tool: tool}} -> {:ok, tool} - _ -> {:error, changeset} - end - end -end diff --git a/core/test/systems/assignment/_public_test.exs b/core/test/systems/assignment/_public_test.exs index b9332d02e..0441ac6a9 100644 --- a/core/test/systems/assignment/_public_test.exs +++ b/core/test/systems/assignment/_public_test.exs @@ -389,14 +389,14 @@ defmodule Systems.Assignment.PublicTest do defp create_assignment(duration, subject_count) do crew = Factories.insert!(:crew) - survey_tool = - Factories.insert!(:survey_tool, %{ - survey_url: "http://eyra.co/survey/123" + questionnaire_tool = + Factories.insert!(:questionnaire_tool, %{ + questionnaire_url: "http://eyra.co/questionnaire/123" }) experiment = Factories.insert!(:experiment, %{ - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, duration: Integer.to_string(duration), subject_count: subject_count }) diff --git a/core/test/systems/assignment/landing_page_test.exs b/core/test/systems/assignment/landing_page_test.exs index f9f677ca0..8b95d56cc 100644 --- a/core/test/systems/assignment/landing_page_test.exs +++ b/core/test/systems/assignment/landing_page_test.exs @@ -9,7 +9,7 @@ defmodule Systems.Assignment.LandingPageTest do Budget } - describe "show landing page for: campaign -> assignment -> survey_tool" do + describe "show landing page for: campaign -> assignment -> questionnaire_tool" do setup [:login_as_member] setup do @@ -24,11 +24,11 @@ defmodule Systems.Assignment.LandingPageTest do pool = Factories.insert!(:pool, %{name: "test_1234", director: :citizen, currency: currency}) - survey_tool = + questionnaire_tool = Factories.insert!( - :survey_tool, + :questionnaire_tool, %{ - survey_url: "https://eyra.co/fake_survey", + questionnaire_url: "https://eyra.co/fake_questionnaire", director: :campaign } ) @@ -38,7 +38,7 @@ defmodule Systems.Assignment.LandingPageTest do :experiment, %{ auth_node: experiment_auth_node, - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, subject_count: 10, duration: "10", language: "en", @@ -130,7 +130,7 @@ defmodule Systems.Assignment.LandingPageTest do |> element("[phx-click=\"open\"]") |> render_click() - assert {:error, {:redirect, %{to: "https://eyra.co/fake_survey?panl_id=1"}}} = html + assert {:error, {:redirect, %{to: "https://eyra.co/fake_questionnaire?panl_id=1"}}} = html task = Crew.Public.get_task!(task.id) assert %Systems.Crew.TaskModel{started_at: started_at, updated_at: updated_at} = task diff --git a/core/test/systems/campaign/_assembly_test.exs b/core/test/systems/campaign/_assembly_test.exs index cb2569410..dfdf602da 100644 --- a/core/test/systems/campaign/_assembly_test.exs +++ b/core/test/systems/campaign/_assembly_test.exs @@ -8,7 +8,7 @@ defmodule Systems.Campaign.AssemblyTest do alias Systems.{ Campaign, Assignment, - Survey, + Questionnaire, Lab, Pool, Budget @@ -68,11 +68,11 @@ defmodule Systems.Campaign.AssemblyTest do subject_count: nil, director: :campaign, lab_tool_id: nil, - survey_tool: %Survey.ToolModel{ - survey_url: nil, + questionnaire_tool: %Questionnaire.ToolModel{ + questionnaire_url: nil, director: :campaign, auth_node: %Core.Authorization.Node{ - parent_id: survey_tool_auth_node_parent_id + parent_id: questionnaire_tool_auth_node_parent_id } }, auth_node: %Core.Authorization.Node{ @@ -114,7 +114,7 @@ defmodule Systems.Campaign.AssemblyTest do assert assignment_auth_node_parent_id == campaign_auth_node_id assert experiment_auth_node_parent_id == assignment_auth_node_id assert crew_auth_node_parent_id == assignment_auth_node_id - assert survey_tool_auth_node_parent_id == experiment_auth_node_id + assert questionnaire_tool_auth_node_parent_id == experiment_auth_node_id assert banner_photo_url == researcher.profile.photo_url assert banner_title == researcher.displayname @@ -195,7 +195,7 @@ defmodule Systems.Campaign.AssemblyTest do language: nil, subject_count: nil, director: :campaign, - survey_tool_id: nil, + questionnaire_tool_id: nil, lab_tool: %Lab.ToolModel{ id: lab_tool_id, director: :campaign, @@ -256,14 +256,14 @@ defmodule Systems.Campaign.AssemblyTest do nil assert Repo.get( - Survey.ToolModel, - campaign.promotable_assignment.assignable_experiment.survey_tool_id + Questionnaire.ToolModel, + campaign.promotable_assignment.assignable_experiment.questionnaire_tool_id ) == nil assert Repo.get( Core.Authorization.Node, - campaign.promotable_assignment.assignable_experiment.survey_tool.auth_node_id + campaign.promotable_assignment.assignable_experiment.questionnaire_tool.auth_node_id ) == nil end @@ -291,7 +291,7 @@ defmodule Systems.Campaign.AssemblyTest do crew: crew1, assignable_experiment: %{ - survey_tool: tool + questionnaire_tool: tool } = experiment } } = Campaign.Public.get!(id, Campaign.Model.preload_graph(:full)) @@ -324,12 +324,12 @@ defmodule Systems.Campaign.AssemblyTest do |> Repo.update!() # Update Tool - survey_url = "https://eyra.co/surveys/1" + questionnaire_url = "https://eyra.co/questionnaires/1" director = :campaign tool - |> Survey.ToolModel.changeset(:update, %{ - survey_url: survey_url, + |> Questionnaire.ToolModel.changeset(:update, %{ + questionnaire_url: questionnaire_url, director: director }) |> Repo.update!() @@ -391,8 +391,8 @@ defmodule Systems.Campaign.AssemblyTest do ethical_code: ^ethical_code, devices: ^devices, director: ^director, - survey_tool: %{ - survey_url: ^survey_url + questionnaire_tool: %{ + questionnaire_url: ^questionnaire_url } } } diff --git a/core/test/systems/campaign/_public_test.exs b/core/test/systems/campaign/_public_test.exs index ca54668e4..ef40b1645 100644 --- a/core/test/systems/campaign/_public_test.exs +++ b/core/test/systems/campaign/_public_test.exs @@ -393,11 +393,11 @@ defmodule Systems.Campaign.PublicTest do }) crew = Factories.insert!(:crew) - survey_tool = Factories.insert!(:survey_tool) + questionnaire_tool = Factories.insert!(:questionnaire_tool) experiment = Factories.insert!(:experiment, %{ - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, duration: "10", subject_count: 1 }) diff --git a/core/test/systems/campaign/monitor_view_test.exs b/core/test/systems/campaign/monitor_view_test.exs index f8ee89fa2..61c0349d4 100644 --- a/core/test/systems/campaign/monitor_view_test.exs +++ b/core/test/systems/campaign/monitor_view_test.exs @@ -205,11 +205,11 @@ defmodule Systems.Campaign.MonitorViewTest do }) crew = Factories.insert!(:crew) - survey_tool = Factories.insert!(:survey_tool) + questionnaire_tool = Factories.insert!(:questionnaire_tool) experiment = Factories.insert!(:experiment, %{ - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, duration: "10", subject_count: subject_count }) diff --git a/core/test/systems/campaign/view_model_builder.exs b/core/test/systems/campaign/view_model_builder.exs index 1e5cdaf01..26c70117f 100644 --- a/core/test/systems/campaign/view_model_builder.exs +++ b/core/test/systems/campaign/view_model_builder.exs @@ -15,8 +15,13 @@ defmodule Systems.Campaign.ViewModelBuilderTest do setup do user = Factories.insert!(:member) - survey_tool = Factories.insert!(:survey_tool, %{survey_url: "https://eyra.co/fake_survey"}) - assignment = Factories.insert!(:assignment, %{survey_tool: survey_tool}) + + questionnaire_tool = + Factories.insert!(:questionnaire_tool, %{ + questionnaire_url: "https://eyra.co/fake_questionnaire" + }) + + assignment = Factories.insert!(:assignment, %{questionnaire_tool: questionnaire_tool}) promotion = Factories.insert!(:promotion, %{ @@ -49,7 +54,7 @@ defmodule Systems.Campaign.ViewModelBuilderTest do assert %{ call_to_action: %{ label: "Naar vragenlijst", - path: "https://eyra.co/fake_survey?panl_id=1", + path: "https://eyra.co/fake_questionnaire?panl_id=1", target: %{type: :event, value: "open"} }, hero_title: "Online Studie", @@ -74,7 +79,7 @@ defmodule Systems.Campaign.ViewModelBuilderTest do assert %{ call_to_action: %{ label: "Naar vragenlijst", - path: "https://eyra.co/fake_survey?panl_id=1", + path: "https://eyra.co/fake_questionnaire?panl_id=1", target: %{type: :event, value: "open"} }, hero_title: "Online Studie", @@ -104,7 +109,7 @@ defmodule Systems.Campaign.ViewModelBuilderTest do assert %{ call_to_action: %{ label: "Naar vragenlijst", - path: "https://eyra.co/fake_survey?panl_id=1", + path: "https://eyra.co/fake_questionnaire?panl_id=1", target: %{type: :event, value: "open"} }, hero_title: "Online Studie", @@ -155,11 +160,11 @@ defmodule Systems.Campaign.ViewModelBuilderTest do setup do user = Factories.insert!(:member) - survey_tool = + questionnaire_tool = Factories.insert!( - :survey_tool, + :questionnaire_tool, %{ - survey_url: "https://eyra.co/fake_survey", + questionnaire_url: "https://eyra.co/fake_questionnaire", subject_count: 10, duration: "10", language: "en", @@ -167,7 +172,7 @@ defmodule Systems.Campaign.ViewModelBuilderTest do } ) - assignment = Factories.insert!(:assignment, %{survey_tool: survey_tool}) + assignment = Factories.insert!(:assignment, %{questionnaire_tool: questionnaire_tool}) promotion = Factories.insert!( diff --git a/core/test/systems/project/assembly_test.exs b/core/test/systems/project/assembly_test.exs index 9e93947d1..0c11aa3bd 100644 --- a/core/test/systems/project/assembly_test.exs +++ b/core/test/systems/project/assembly_test.exs @@ -18,7 +18,7 @@ defmodule Systems.Project.AssemblyTest do project_path: [^project_id, ^root_id], node_id: ^root_id, tool_ref: %Systems.Project.ToolRefModel{ - survey_tool_id: nil, + questionnaire_tool_id: nil, lab_tool_id: nil, data_donation_tool_id: nil, benchmark_tool: %Systems.Benchmark.ToolModel{ @@ -43,7 +43,7 @@ defmodule Systems.Project.AssemblyTest do project_path: [^project_id, ^root_id], node_id: ^root_id, tool_ref: %Systems.Project.ToolRefModel{ - survey_tool_id: nil, + questionnaire_tool_id: nil, lab_tool_id: nil, data_donation_tool: %Systems.DataDonation.ToolModel{ status: :concept, diff --git a/core/test/systems/promotion/landing_page_test.exs b/core/test/systems/promotion/landing_page_test.exs index 9390d5052..56ca51482 100644 --- a/core/test/systems/promotion/landing_page_test.exs +++ b/core/test/systems/promotion/landing_page_test.exs @@ -9,7 +9,7 @@ defmodule Systems.Promotion.LandingPageTest do Budget } - describe "show landing page for: campaign -> assignment -> survey_tool" do + describe "show landing page for: campaign -> assignment -> questionnaire_tool" do setup [:login_as_member] setup do @@ -19,11 +19,11 @@ defmodule Systems.Promotion.LandingPageTest do pool = Factories.insert!(:pool, %{name: "test_1234", director: :citizen, currency: currency}) - survey_tool = + questionnaire_tool = Factories.insert!( - :survey_tool, + :questionnaire_tool, %{ - survey_url: "https://eyra.co/fake_survey" + questionnaire_url: "https://eyra.co/fake_questionnaire" } ) @@ -31,7 +31,7 @@ defmodule Systems.Promotion.LandingPageTest do Factories.insert!( :experiment, %{ - survey_tool: survey_tool, + questionnaire_tool: questionnaire_tool, subject_count: 10, duration: "10", language: "en", diff --git a/core/test/systems/questionnaire/_public_test.exs b/core/test/systems/questionnaire/_public_test.exs new file mode 100644 index 000000000..eae8ef7a6 --- /dev/null +++ b/core/test/systems/questionnaire/_public_test.exs @@ -0,0 +1,65 @@ +defmodule Systems.Questionnaire.PublicTest do + use Core.DataCase + + alias Systems.{ + Questionnaire + } + + describe "questionnaire_tools" do + alias Core.Factories + + @update_attrs %{questionnaire_url: "http://eyra.co/fake_questionnaire"} + + test "list_questionnaire_tools/0 returns all questionnaire_tools" do + questionnaire_tool = Factories.insert!(:questionnaire_tool) + + assert Questionnaire.Public.list_questionnaire_tools() + |> Enum.map(& &1.id) + |> MapSet.new() + |> MapSet.member?(questionnaire_tool.id) + end + + test "get_questionnaire_tool!/1 returns the questionnaire_tool with given id" do + questionnaire_tool = Factories.insert!(:questionnaire_tool) + + assert Questionnaire.Public.get_questionnaire_tool!(questionnaire_tool.id).id == + questionnaire_tool.id + end + + test "create_tool/1 with valid data creates a questionnaire_tool" do + auth_node = Factories.insert!(:auth_node) + + assert {:ok, %Questionnaire.ToolModel{} = _questionnaire_tool} = + Questionnaire.Public.create_tool(%{}, auth_node) + end + + test "update_questionnaire_tool/2 with valid data updates the questionnaire_tool" do + questionnaire_tool = Factories.insert!(:questionnaire_tool) + + assert {:ok, %{tool: questionnaire_tool}} = + Questionnaire.Public.update_questionnaire_tool( + questionnaire_tool, + :auto_save, + @update_attrs + ) + + assert questionnaire_tool.questionnaire_url == "http://eyra.co/fake_questionnaire" + end + + test "delete_questionnaire_tool/1 deletes the questionnaire_tool" do + questionnaire_tool = Factories.insert!(:questionnaire_tool) + assert {:ok, %{}} = Questionnaire.Public.delete_questionnaire_tool(questionnaire_tool) + + assert_raise Ecto.NoResultsError, fn -> + Questionnaire.Public.get_questionnaire_tool!(questionnaire_tool.id) + end + end + + test "change_questionnaire_tool/1 returns a questionnaire_tool changeset" do + questionnaire_tool = Factories.insert!(:questionnaire_tool) + + assert %Ecto.Changeset{} = + Questionnaire.Public.change_questionnaire_tool(questionnaire_tool, :mount) + end + end +end diff --git a/core/test/systems/survey/tool_model_test.exs b/core/test/systems/questionnaire/tool_model_test.exs similarity index 55% rename from core/test/systems/survey/tool_model_test.exs rename to core/test/systems/questionnaire/tool_model_test.exs index 8d541493b..5e544ac43 100644 --- a/core/test/systems/survey/tool_model_test.exs +++ b/core/test/systems/questionnaire/tool_model_test.exs @@ -1,8 +1,8 @@ -defmodule Systems.Survey.ToolModelTest do +defmodule Systems.Questionnaire.ToolModelTest do use Core.DataCase, async: true alias Systems.{ - Survey + Questionnaire } describe "validate_url" do @@ -15,35 +15,39 @@ defmodule Systems.Survey.ToolModelTest do ] do test "allow #{url}" do changeset = - Survey.ToolModel.changeset(%Survey.ToolModel{}, :auto_save, %{survey_url: unquote(url)}) + Questionnaire.ToolModel.changeset(%Questionnaire.ToolModel{}, :auto_save, %{ + questionnaire_url: unquote(url) + }) assert changeset.valid?, changeset.errors end end for url <- [ - "http://example.org/survey?a=", - "http://example.org/survey?c=", - "http://example.org/survey?d=" + "http://example.org/questionnaire?a=", + "http://example.org/questionnaire?c=", + "http://example.org/questionnaire?d=" ] do test "disallow URL: #{url}" do changeset = - Survey.ToolModel.changeset(%Survey.ToolModel{}, :auto_save, %{survey_url: unquote(url)}) + Questionnaire.ToolModel.changeset(%Questionnaire.ToolModel{}, :auto_save, %{ + questionnaire_url: unquote(url) + }) refute changeset.valid? end end end - describe "prepare_survey_url" do + describe "prepare_questionnaire_url" do test "URL without params stays the same" do - assert Survey.ToolModel.prepare_url("http://example.org/test?a=b", %{}) == + assert Questionnaire.ToolModel.prepare_url("http://example.org/test?a=b", %{}) == "http://example.org/test?a=b" end test "URL with param has replacement" do - assert Survey.ToolModel.prepare_url( + assert Questionnaire.ToolModel.prepare_url( "http://example.org/test?participant=", %{ "participantId" => 123 diff --git a/core/test/systems/survey/_public_test.exs b/core/test/systems/survey/_public_test.exs deleted file mode 100644 index cac1e5b7f..000000000 --- a/core/test/systems/survey/_public_test.exs +++ /dev/null @@ -1,53 +0,0 @@ -defmodule Systems.Survey.PublicTest do - use Core.DataCase - - alias Systems.{ - Survey - } - - describe "survey_tools" do - alias Core.Factories - - @update_attrs %{survey_url: "http://eyra.co/fake_survey"} - - test "list_survey_tools/0 returns all survey_tools" do - survey_tool = Factories.insert!(:survey_tool) - - assert Survey.Public.list_survey_tools() - |> Enum.map(& &1.id) - |> MapSet.new() - |> MapSet.member?(survey_tool.id) - end - - test "get_survey_tool!/1 returns the survey_tool with given id" do - survey_tool = Factories.insert!(:survey_tool) - assert Survey.Public.get_survey_tool!(survey_tool.id).id == survey_tool.id - end - - test "create_tool/1 with valid data creates a survey_tool" do - auth_node = Factories.insert!(:auth_node) - - assert {:ok, %Survey.ToolModel{} = _survey_tool} = Survey.Public.create_tool(%{}, auth_node) - end - - test "update_survey_tool/2 with valid data updates the survey_tool" do - survey_tool = Factories.insert!(:survey_tool) - - assert {:ok, %{tool: survey_tool}} = - Survey.Public.update_survey_tool(survey_tool, :auto_save, @update_attrs) - - assert survey_tool.survey_url == "http://eyra.co/fake_survey" - end - - test "delete_survey_tool/1 deletes the survey_tool" do - survey_tool = Factories.insert!(:survey_tool) - assert {:ok, %{}} = Survey.Public.delete_survey_tool(survey_tool) - assert_raise Ecto.NoResultsError, fn -> Survey.Public.get_survey_tool!(survey_tool.id) end - end - - test "change_survey_tool/1 returns a survey_tool changeset" do - survey_tool = Factories.insert!(:survey_tool) - assert %Ecto.Changeset{} = Survey.Public.change_survey_tool(survey_tool, :mount) - end - end -end