Skip to content

Commit

Permalink
Renamed Survey => Questionnaire and copy changes for data donation
Browse files Browse the repository at this point in the history
  • Loading branch information
mellelieuwes committed Jul 7, 2023
1 parent 8f2c0bb commit 368579d
Show file tree
Hide file tree
Showing 69 changed files with 568 additions and 524 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Eyra Mono

Primary collection of Eyra projects
Primary collection of Eyra projects

## Projects

Expand All @@ -19,7 +19,7 @@ Project implementing a SaaS platform based on interlinked modules called Systems
* Campaign
* Assignment
* Lab
* Survey
* Questionnaire
* Pool
* Data Donation
* ..
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions core/bundles/link/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(),
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions core/lib/core/authorization.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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]
})

Expand Down
27 changes: 15 additions & 12 deletions core/lib/core/factories.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Core.Factories do
Assignment,
Crew,
Support,
Survey,
Questionnaire,
Lab,
DataDonation,
Benchmark,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -462,21 +462,24 @@ 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}
end

%Assignment.ExperimentModel{
auth_node: auth_node,
survey_tool: survey_tool,
questionnaire_tool: questionnaire_tool,
lab_tool: lab_tool
}
|> struct!(attributes)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule CoreWeb.FakeSurveyController do
defmodule CoreWeb.FakeQuestionnaireController do
use CoreWeb, :controller

def index(conn, _params) do
Expand Down
5 changes: 5 additions & 0 deletions core/lib/core_web/controllers/fake_questionnaire_html.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule CoreWeb.FakeQuestionnaireHTML do
use CoreWeb, :html

embed_templates("fake_questionnaire_html/*")
end
5 changes: 0 additions & 5 deletions core/lib/core_web/controllers/fake_survey_html.ex

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule CoreWeb.FakeSurvey do
defmodule CoreWeb.FakeQuestionnaire do
@moduledoc """
The home screen.
"""
Expand All @@ -25,14 +25,14 @@ defmodule CoreWeb.FakeSurvey do
def render(assigns) do
~H"""
<div>
<Hero.small title="Fake survey" bg_color="bg-grey1" />
<Hero.small title="Fake questionnaire" bg_color="bg-grey1" />
<Area.content>
<Margin.y id={:page_top} />
<Text.title2>Fake survey</Text.title2>
<Text.body_large>This fake survey is used to validate the survey tool flow with an external tool.</Text.body_large>
<Text.title2>Fake questionnaire</Text.title2>
<Text.body_large>This fake questionnaire is used to validate the survey tool flow with an external tool.</Text.body_large>
<.spacing value="M" />
<Button.primary label="Complete survey (go back)" to={@redirect_url} bg_color="bg-grey1" />
<Button.primary label="Complete questionnaire (go back)" to={@redirect_url} bg_color="bg-grey1" />
</Area.content>
</div>
"""
Expand Down
2 changes: 1 addition & 1 deletion core/lib/core_web/live/routes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/lib/core_web/loaders.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 23 additions & 19 deletions core/priv/gettext/en/LC_MESSAGES/eyra-data-donation.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,57 @@ 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"
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"
Expand All @@ -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"
Expand All @@ -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"
2 changes: 1 addition & 1 deletion core/priv/gettext/en/LC_MESSAGES/eyra-enums.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions core/priv/gettext/en/LC_MESSAGES/eyra-project.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 0 additions & 11 deletions core/priv/gettext/en/LC_MESSAGES/eyra-survey.po

This file was deleted.

Loading

0 comments on commit 368579d

Please sign in to comment.