survey/app/views/surveys/_answer_success.erb

15 lines
499 B
Plaintext

<% @survey.result_type.inspect %>
<% if @survey.result_type == 3 %>
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 %>
window.location.href = "<%= page_for_survey %>";