学生查看问卷答题结果时按题号排序

This commit is contained in:
cxt 2016-10-31 10:41:00 +08:00
parent 557f5d4e26
commit 157cf4262f
6 changed files with 31 additions and 43 deletions

View File

@ -521,7 +521,7 @@ class PollController < ApplicationController
#显示某个学生某份问卷的填写结果
def poll_result
@poll_questions = paginateHelper @poll.poll_questions,5
@poll_questions = @poll.poll_questions
@left_nav_type = 7
respond_to do |format|
format.html{render :layout => 'base_courses'}

View File

@ -2,9 +2,21 @@
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="fontBlue">[多选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
<% if poll_question.min_choices != 0 || poll_question.max_choices != 0 %>
<p class="fontGrey2">
<% if poll_question.min_choices != 0 && poll_question.max_choices != 0 %>
答题时最少选<%=poll_question.min_choices %>项、最多选<%=poll_question.max_choices %>项
<% elsif poll_question.min_choices != 0 %>
答题时最少选<%=poll_question.min_choices %>项
<% elsif poll_question.max_choices != 0 %>
答题时最多选<%=poll_question.max_choices %>项
<% end %>
</p>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">

View File

@ -2,6 +2,7 @@
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="fontBlue">[单选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>

View File

@ -2,6 +2,7 @@
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="fontBlue">[多行主观题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>

View File

@ -2,6 +2,7 @@
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="fontBlue">[主观题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>

View File

@ -7,50 +7,23 @@
</h1>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>
</div>
<% mc_question_list = @poll.poll_questions.where("question_type=1") %>
<% mcq_question_list = @poll.poll_questions.where("question_type=2") %>
<% single_question_list = @poll.poll_questions.where("question_type=3") %>
<% multi_question_list = @poll.poll_questions.where("question_type=4") %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %>
<% @poll_questions.each do |poll_question|%>
<div class="testStatus">
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<% if poll_question.question_type == 1%>
<%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 2%>
<%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 3%>
<%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 4%>
<%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %>
<% end%>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单行主观题</h3>
<% single_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多行主观题</h3>
<% multi_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<% end%>
<div class="cl"></div>
</div>
</div><!--问卷内容end-->