This commit is contained in:
huang 2015-01-16 10:51:08 +08:00
parent 2b0775da26
commit 34b8ffeb5b
5 changed files with 25 additions and 10 deletions

View File

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

View File

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

View File

@ -1,3 +1,4 @@
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
@ -9,13 +10,13 @@
<% poll_question.poll_answers.each do |poll_answer| %>
<tr>
<td class="td327"><%= poll_answer.answer_text %> </td>
<td class="td42">24 </td>
<td class="td42"><% poll_answer.poll_votes.count %> </td>
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
</tr>
<% end %>
<tr class="table_bluebg">
<td class="td327">本题有效填写人次 </td>
<td class="td42">26</td>
<td class="td42"><%= poll_question.poll_votes.count %></td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>

View File

@ -17,19 +17,21 @@
<ol>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第1题</span>问题描述问题描述<%= poll_question.question_title %> <span class="title_index">[单选题]<% poll_question.poll_answers %></span>
<span class="title_index">第<%= poll_question.question_number %>题:</span><%= poll_question.question_title %> <span class="title_index">[单选题]<% poll_question.poll_answers %></span>
</div>
<%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
</li>
</ol>
<div class="pagination">
<%= pagination_links_full @poll_questions_pages, @poll_questions_count %>
</div>
<% end %>
<div class="ur_buttons">
<!--<a href="#" class=" ur_button" >上一页</a>-->
<!--<a href="#" class="ur_button" >下一页</a>-->
</div>
<div class="cl"></div>
<div class="ur_progress_text">答题已完成 <strong class="ur_progress_number">0%</strong> </div>
<div class="ur_progress_text">答题已完成 <strong class="ur_progress_number">0%</strong> </div>
</div>
</div><!--问卷内容end-->

View File

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