This commit is contained in:
BoHung Chiu 2022-08-29 09:10:18 +08:00
parent b8da4b081e
commit a8297c70b8
1 changed files with 11 additions and 1 deletions

View File

@ -279,6 +279,16 @@
<% answers_nil = @survey_answers.nil? %> <% answers_nil = @survey_answers.nil? %>
<% (@survey_answer_groups || @survey_answers).each do |sa| %> <% (@survey_answer_groups || @survey_answers).each do |sa| %>
<tr> <tr>
<%
link_sa = sa
if answers_nil
link_sa = sa.survey_answers.last
if link_sa.nil?
sa.destroy
next
end
end
%>
<% user = sa.user.nil? ? nil : (User.find(sa.user) rescue nil) %> <% user = sa.user.nil? ? nil : (User.find(sa.user) rescue nil) %>
<% if !user.nil? %> <% if !user.nil? %>
<td><%= user.member_name rescue user.name %></td> <td><%= user.member_name rescue user.name %></td>
@ -291,7 +301,7 @@
<a class="btn btn-primary" href="/admin/surveys/<%= sa.id.to_s %>/answer_list"><%= t("survey.view") %>(<%=sa.survey_answer_ids.count%>)</a> <a class="btn btn-primary" href="/admin/surveys/<%= sa.id.to_s %>/answer_list"><%= t("survey.view") %>(<%=sa.survey_answer_ids.count%>)</a>
<button class="btn btn-primary export-xls" data-href="/admin/surveys/<%= sa.id.to_s %>/export_answers"><%= t("survey.export") %></button> <button class="btn btn-primary export-xls" data-href="/admin/surveys/<%= sa.id.to_s %>/export_answers"><%= t("survey.export") %></button>
<% else %> <% else %>
<% sa = sa.survey_answers.last if answers_nil %> <% sa = link_sa %>
<% if @survey.result_type == QuestionnaireSurvey::ResultCriteria %> <% if @survey.result_type == QuestionnaireSurvey::ResultCriteria %>
<% tmp_msgs = [] <% tmp_msgs = []
answer_model_attrs = sa.attributes answer_model_attrs = sa.attributes