survey/app/views/surveys/_answer_success.erb

15 lines
533 B
Plaintext
Raw Normal View History

<% @survey.result_type.inspect %>
2021-10-13 09:15:47 +00:00
<% if @survey.result_type == QuestionnaireSurvey::ResultCriteria %>
var scoredPoints = <%= @answer_model.scored_points %>,
msg = "";
<% @survey.result_criteria.each do |criteria| %>
<% if (criteria[0].to_i..criteria[1].to_i).cover?(@answer_model.scored_points) %>
msg = "<%= criteria[2] %>";
<% end %>
<% end %>
alert("Your total score is " + scoredPoints + "; " + msg);
<% else %>
alert("<%= t('survey.answer_success')%>");
<% end %>
2014-10-06 05:55:25 +00:00
window.location.href = "<%= page_for_survey %>";