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 @@ +
<%= poll_answer.answer_text %> | -24 | +<% poll_answer.poll_votes.count %> | 75% |
本题有效填写人次 | -26 | +<%= poll_question.poll_votes.count %> |