survey/app/views/surveys/answer_success.html.erb

24 lines
745 B
Plaintext
Raw Normal View History

<%
data = action_data
@survey = data['survey']
@answer_model = data['answer']
%>
<% if @survey.result_type == 3 %>
<h3>Your total score is <%= @answer_model.scored_points %> </h3>
<% @survey.result_criteria.each do |criteria| %>
2016-10-29 11:33:54 +00:00
<%
total_criteria_score = 0
2016-11-16 10:46:58 +00:00
((criteria["questions"][0].to_i - 1)..(criteria["questions"][1].to_i - 1)).each do |x|
2016-10-29 11:33:54 +00:00
total_criteria_score = (total_criteria_score + @answer_model.individual_total[x].to_i) rescue 0
end
%>
<% if (criteria["range"][0].to_i..criteria["range"][1].to_i).cover?(total_criteria_score) %>
<div> <%= criteria["msg"].html_safe %> </div>
<% end %>
<% end %>
<% else %>
<h3><%= t('survey.answer_success')%></h3>
<% end %>
<a href="<%= data['url'] %>">Go Back</a>