From 5de4fd77774adf951456fc93babb60aa0ab39c96 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 30 Nov 2015 18:21:58 +0800 Subject: [PATCH] survey redirection fixed --- app/controllers/surveys_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/surveys_controller.rb b/app/controllers/surveys_controller.rb index 4f1405f..3e87ef5 100644 --- a/app/controllers/surveys_controller.rb +++ b/app/controllers/surveys_controller.rb @@ -44,6 +44,7 @@ class SurveysController < ApplicationController survey = QuestionnaireSurvey.find_by(uid: params[:uid]) current_user = OrbitHelper.current_user answer_present = (current_user.nil? ? false : (survey.survey_answers.where(:user => current_user.id).count > 0 ? true : false)) + answer_present = (!survey.needs_login ? false : answer_present) link_to_answer_set = (answer_present ? "/admin/surveys/#{survey.survey_answers.where(:user => current_user.id).first.id.to_s}/answer_set" : "") { 'survey' => survey, @@ -74,6 +75,7 @@ class SurveysController < ApplicationController questions = survey.survey_questions.all.entries current_user = OrbitHelper.current_user answer_present = (current_user.nil? ? false : (survey.survey_answers.where(:user => current_user.id).count > 0 ? true : false)) + answer_present = (!survey.needs_login ? false : answer_present) link_to_answer_set = (answer_present ? "/admin/surveys/#{survey.survey_answers.where(:user => current_user.id).first.id.to_s}/answer_set" : "") if survey.jump_mode answers = Hash[questions.collect{ |o| [o.id.to_s, o.id.to_s] }]