diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 084c43545..774923404 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -78,12 +78,24 @@ class PollController < ApplicationController end def statistics_result - @poll_questions = PollQuestion.all + @poll = Poll.find(params[:id]) + @offset, @limit = api_offset_and_limit({:limit => 10}) + @poll_questions = @poll.poll_questions + @poll_questions_count = @poll_questions.count + @poll_questions_pages = Paginator.new @poll_questions_count, @limit, params['page'] respond_to do |format| format.html{render :layout => 'base_courses'} end end + def get_poll_totalcount poll_question + @total_questions_count = poll_question.poll_votes.count + end + + def get_poll_everycount poll_answer + @every_answer_count = poll_answer.poll_votes.count + end + #添加单选题 def create_poll_question question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title] @@ -111,7 +123,7 @@ class PollController < ApplicationController end end - private + private def find_poll_and_course @poll = Poll.find params[:id] @course = Course.find @poll.polls_group_id diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5d43a4e20..5ff9a3f17 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -116,8 +116,8 @@ class ProjectsController < ApplicationController joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id"). where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project) - @project_count = @projects_all.count - @project_pages = Paginator.new @project_count, per_page_option, params['page'] + @poll_questions_count = @projects_all.count + @poll_questions_pages = Paginator.new @project_count, per_page_option, params['page'] #gcm activity count diff --git a/app/views/poll/_choice_show.html.erb b/app/views/poll/_choice_show.html.erb index a37ca148a..aa425e748 100644 --- a/app/views/poll/_choice_show.html.erb +++ b/app/views/poll/_choice_show.html.erb @@ -1,3 +1,4 @@ +
@@ -9,13 +10,13 @@ <% poll_question.poll_answers.each do |poll_answer| %> - + <% end %> - + diff --git a/app/views/poll/statistics_result.html.erb b/app/views/poll/statistics_result.html.erb index f0f992c90..1bdbb0ff1 100644 --- a/app/views/poll/statistics_result.html.erb +++ b/app/views/poll/statistics_result.html.erb @@ -17,19 +17,21 @@
  1. - 第1题:问题描述问题描述<%= poll_question.question_title %> [单选题]<% poll_question.poll_answers %> + 第<%= poll_question.question_number %>题:<%= poll_question.question_title %> [单选题]<% poll_question.poll_answers %>
    <%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
+ <% end %>
-
答题已完成 0%
- +
答题已完成 0%
diff --git a/db/schema.rb b/db/schema.rb index 6c2a9f58a..f9ea40ae9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150112090810) do +ActiveRecord::Schema.define(:version => 20150114022710) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false
<%= poll_answer.answer_text %> 24 <% poll_answer.poll_votes.count %>
75%
本题有效填写人次 26<%= poll_question.poll_votes.count %>