diff --git a/app/controllers/surveys_controller.rb b/app/controllers/surveys_controller.rb index efc8b8c..a8e1939 100644 --- a/app/controllers/surveys_controller.rb +++ b/app/controllers/surveys_controller.rb @@ -256,6 +256,7 @@ class SurveysController < ApplicationController if @answer_model.errors.empty? @answer_model.scored_points = total @answer_model.individual_total = individual_total + @answer_model.consent_used = answer[:consent_used] @answer_model.save! params[:url] = params[:show_page_url] OrbitHelper.set_params(params,current_user) diff --git a/app/models/questionnaire_survey.rb b/app/models/questionnaire_survey.rb index 86cdca5..5ae7dc2 100644 --- a/app/models/questionnaire_survey.rb +++ b/app/models/questionnaire_survey.rb @@ -12,6 +12,8 @@ class QuestionnaireSurvey include OrbitCategory::Categorizable scope :can_display, ->{where(is_hidden: false)} + field :enable_consent_feature, :type => Boolean, :default => false + field :consent_contents, :type => String, :default => "", :localize => true field :already_fix_data, :type => Boolean, :default => false field :copy_id field :except_clone_relations, :type=>Array, :default => [] @@ -426,7 +428,7 @@ class QuestionnaireSurvey else oid = d['oid'] end - t2 += tmp[oid]["base"] rescue nil + t2 = tmp[oid]["base"] rescue nil if t2 t += t2 level2s.each do |level2_id| diff --git a/app/models/survey_answer.rb b/app/models/survey_answer.rb index 6d8f276..bf27829 100644 --- a/app/models/survey_answer.rb +++ b/app/models/survey_answer.rb @@ -4,6 +4,7 @@ class SurveyAnswer include Mongoid::Attributes::Dynamic field :user, type: BSON::ObjectId + field :consent_used, type: Boolean, :default => false field :scored_points, type: Integer, :default => 0 field :avg_points, type: Integer field :individual_total, type: Array, :default => [] diff --git a/app/views/admin/surveys/_form.html.erb b/app/views/admin/surveys/_form.html.erb index c153820..41f8ca4 100644 --- a/app/views/admin/surveys/_form.html.erb +++ b/app/views/admin/surveys/_form.html.erb @@ -124,7 +124,31 @@ <%= f.text_field :redirect_url, :class=>"input-xlarge", :placeholder=>"Redirect URL" %> - +