Skip to content

Commit

Permalink
Check answer questionnaire response (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurajaime authored Jun 7, 2022
1 parent 36170ed commit fe393d4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Following Semantic Versioning 2.

## next version:

## Version 0.0.15 (PATCH)
- Check if the file has any errors in format in the Challenges surveys.

## Version 0.0.14 (PATCH)
- Add missing translations in :es and :en.

Expand Down
13 changes: 11 additions & 2 deletions app/commands/decidim/challenges/survey_challenge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def call
return broadcast(:invalid) unless can_answer_survey?
return broadcast(:invalid_form) unless survey_form.valid?

answer_questionnaire
return broadcast(:invalid) if answer_questionnaire == :invalid

create_survey
end
broadcast(:ok)
Expand All @@ -37,7 +38,15 @@ def call
def answer_questionnaire
return unless questionnaire?

Decidim::Forms::AnswerQuestionnaire.call(survey_form, user, challenge.questionnaire)
Decidim::Forms::AnswerQuestionnaire.call(survey_form, user, challenge.questionnaire) do
on(:ok) do
return :valid
end

on(:invalid) do
return :invalid
end
end
end

def create_survey
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/challenges/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Decidim
# This holds the decidim-meetings version.
module Challenges
def self.version
"0.0.14"
"0.0.15"
end

def self.decidim_version
Expand Down

0 comments on commit fe393d4

Please sign in to comment.