Closed
Conversation
Contributor
|
I'll reuse this PR to implement #5728. |
c2e2cbe to
844f877
Compare
3f8866a to
528c1e5
Compare
8ab3d70 to
dabfa38
Compare
838cb82 to
ec443f0
Compare
9ff5e2b to
063696a
Compare
99c0431 to
23b48a9
Compare
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
This PR adds multiple pages to a survey. Since a
Surveyhas oneQuestionnaire, we useQuestionnaires as steps, changing the kind of relation to ahas_many. This change doesn't affect the DB.Then we change the
decidim-formsmodule 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
QuestionnaireAnswermodel, which relates to aQuestionnaireand aUserand is used to detect whether the givenQuestionnairehas been answered by that user or not.QuestionnaireAnswerrows 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
QuestionnaireAnswerfor that step will not be created until the survey is actually submitted.This PR implies breaking changes:
.questionnaire. They now respond to.questionnaires, and returns a list.📌 Related Issues
📋 Subtasks
CHANGELOGentryQuestionnaireAnswermodel and related migrations. Use that value to check whether the questionnaire has been answered or not.Surveyhave multiple questionnaires. No need for migration, only change theHasQuestionnaireconcern. From now on, each questionnaire will be considered a different step/page of the same survey.QuestionnaireAnsweron survey submission📷 Screenshots (optional)