Skip to content

Survey steps#6010

Closed
htmlboy wants to merge 28 commits intodevelopfrom
feat/pam2020/survey-steps
Closed

Survey steps#6010
htmlboy wants to merge 28 commits intodevelopfrom
feat/pam2020/survey-steps

Conversation

@htmlboy
Copy link
Copy Markdown
Contributor

@htmlboy htmlboy commented Apr 21, 2020

🎩 What? Why?

This PR adds multiple pages to a survey. Since a Survey has one Questionnaire, we use Questionnaires as steps, changing the kind of relation to a has_many. This change doesn't affect the DB.

Then we change the decidim-forms module to handle resources with a single questionnaire, or with multiple questionnaires. The number of questionnaires a resource has will be determined by the resource itself. Each questionnaire will be a different step.

This PR also changes the way to find out if a survey has been answered or not. We're currently relying on the questionnaire having answers, but this system would get costly with the refactors in this PR. Thus, we're creating a QuestionnaireAnswer model, which relates to a Questionnaire and a User and is used to detect whether the given Questionnaire has been answered by that user or not. QuestionnaireAnswer rows will only be created when the survey is sent. This change requires migrating the existing data.

This means that when a user moves from step 1 to step 2 of the survey, answers for step 1 will be persisted to the DB, but the QuestionnaireAnswer for that step will not be created until the survey is actually submitted.

This PR implies breaking changes:

  • Surveys no longer respond to .questionnaire. They now respond to .questionnaires, and returns a list.
    • This affects the GraphQL API and the Surveys Importer

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add the QuestionnaireAnswer model and related migrations. Use that value to check whether the questionnaire has been answered or not.
  • Let Survey have multiple questionnaires. No need for migration, only change the HasQuestionnaire concern. From now on, each questionnaire will be considered a different step/page of the same survey.
  • Admin: List questionnaires when accessing the component
  • Admin: allow users to create other pages for the same survey.
  • Admin: allow admins to destroy questionnaires
  • Admin: reorder steps (buttons just like questions)
  • Public: show current step and total number of steps in the survey
  • Public: Add navigation between steps
  • Public: Only require TOS on last step
  • Public: When changing steps, submit question answers
  • Public: Create QuestionnaireAnswer on survey submission
  • Public: Recover answers on previous steps
  • Ensure multiple step submissions update answers instead of creating new ones
  • Ensure all changes apply to meetings
  • Implement Display number of responses in the survey administration panel #5729 if not done previously

📷 Screenshots (optional)

Description

@andreslucena andreslucena changed the title Survey steps Mockup design for Survey steps Apr 23, 2020
@mrcasals
Copy link
Copy Markdown
Contributor

I'll reuse this PR to implement #5728.

@mrcasals mrcasals force-pushed the feat/pam2020/survey-steps branch from c2e2cbe to 844f877 Compare April 29, 2020 15:51
@mrcasals mrcasals changed the title Mockup design for Survey steps Survey steps May 5, 2020
@mrcasals mrcasals self-assigned this May 5, 2020
@mrcasals mrcasals force-pushed the feat/pam2020/survey-steps branch from 3f8866a to 528c1e5 Compare May 5, 2020 07:11
@mrcasals mrcasals added the project: PAM2020 Barcelona City Council contract label May 5, 2020
@mrcasals mrcasals force-pushed the feat/pam2020/survey-steps branch 7 times, most recently from 8ab3d70 to dabfa38 Compare May 13, 2020 09:54
@mrcasals mrcasals force-pushed the feat/pam2020/survey-steps branch 2 times, most recently from 838cb82 to ec443f0 Compare May 14, 2020 11:57
@mrcasals mrcasals force-pushed the feat/pam2020/survey-steps branch from 9ff5e2b to 063696a Compare May 18, 2020 06:53
@mrcasals mrcasals force-pushed the feat/pam2020/survey-steps branch from 99c0431 to 23b48a9 Compare May 18, 2020 07:16
@mrcasals mrcasals mentioned this pull request May 18, 2020
8 tasks
@mrcasals
Copy link
Copy Markdown
Contributor

I've been rethinking about how I approach this issue and I think there are simpler alternatives for the same solution. I'm closing this PR in favor of #6108

@mrcasals mrcasals closed this May 18, 2020
@htmlboy htmlboy deleted the feat/pam2020/survey-steps branch August 10, 2020 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project: PAM2020 Barcelona City Council contract status: WIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EPIC: Improve the Survey component

2 participants