|
|
|
@ -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
|
|
|
|
|