From 157cf4262f3ccc4ea2b3f95b3a46d1b6f8dafe36 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 31 Oct 2016 10:41:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=9F=A5=E7=9C=8B=E9=97=AE?= =?UTF-8?q?=E5=8D=B7=E7=AD=94=E9=A2=98=E7=BB=93=E6=9E=9C=E6=97=B6=E6=8C=89?= =?UTF-8?q?=E9=A2=98=E5=8F=B7=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 2 +- app/views/poll/_show_MCQ_result.html.erb | 12 +++++ app/views/poll/_show_MC_result.html.erb | 1 + app/views/poll/_show_mulit_result.html.erb | 1 + app/views/poll/_show_single_result.html.erb | 1 + app/views/poll/poll_result.html.erb | 57 ++++++--------------- 6 files changed, 31 insertions(+), 43 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 263ffbaa5..08e221d5e 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -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'} diff --git a/app/views/poll/_show_MCQ_result.html.erb b/app/views/poll/_show_MCQ_result.html.erb index 4129f164b..0a5f79e2e 100644 --- a/app/views/poll/_show_MCQ_result.html.erb +++ b/app/views/poll/_show_MCQ_result.html.erb @@ -2,9 +2,21 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [多选题] <%if poll_question.is_necessary == 1%> * <%end%> + <% if poll_question.min_choices != 0 || poll_question.max_choices != 0 %> +

+ <% 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 %> +

+ <% end %>
diff --git a/app/views/poll/_show_MC_result.html.erb b/app/views/poll/_show_MC_result.html.erb index d154468b3..141702f36 100644 --- a/app/views/poll/_show_MC_result.html.erb +++ b/app/views/poll/_show_MC_result.html.erb @@ -2,6 +2,7 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [单选题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/_show_mulit_result.html.erb b/app/views/poll/_show_mulit_result.html.erb index da72ea35d..14ba41d5b 100644 --- a/app/views/poll/_show_mulit_result.html.erb +++ b/app/views/poll/_show_mulit_result.html.erb @@ -2,6 +2,7 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [多行主观题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/_show_single_result.html.erb b/app/views/poll/_show_single_result.html.erb index 4fbf3698f..c5fcd4ed4 100644 --- a/app/views/poll/_show_single_result.html.erb +++ b/app/views/poll/_show_single_result.html.erb @@ -2,6 +2,7 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [主观题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/poll_result.html.erb b/app/views/poll/poll_result.html.erb index bb9aa7f63..59096fd8c 100644 --- a/app/views/poll/poll_result.html.erb +++ b/app/views/poll/poll_result.html.erb @@ -7,50 +7,23 @@
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
- <% 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") %> -
"> -

单选题

- <% mc_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %> + <% @poll_questions.each do |poll_question|%> +
+
+
+ <% 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%> +
- <% end %> -
-
"> -

多选题

- <% mcq_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %> -
-
- <% end %> -
-
"> -

单行主观题

- <% single_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %> -
-
- <% end %> -
-
"> -

多行主观题

- <% multi_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %> -
-
- <% end %> -
+ <% end%>