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 end
def statistics_result 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| respond_to do |format|
format.html{render :layout => 'base_courses'} format.html{render :layout => 'base_courses'}
end end
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 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] question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title]

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"). 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) where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project)
@project_count = @projects_all.count @poll_questions_count = @projects_all.count
@project_pages = Paginator.new @project_count, per_page_option, params['page'] @poll_questions_pages = Paginator.new @project_count, per_page_option, params['page']
#gcm activity count #gcm activity count

View File

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

View File

@ -17,11 +17,14 @@
<ol> <ol>
<li class="ur_question_item"> <li class="ur_question_item">
<div class="ur_title_result"> <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> </div>
<%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %> <%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
</li> </li>
</ol> </ol>
<div class="pagination">
<%= pagination_links_full @poll_questions_pages, @poll_questions_count %>
</div>
<% end %> <% end %>
<div class="ur_buttons"> <div class="ur_buttons">
<!--<a href="#" class=" ur_button" >上一页</a>--> <!--<a href="#" class=" ur_button" >上一页</a>-->
@ -29,7 +32,6 @@
</div> </div>
<div class="cl"></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>
</div><!--问卷内容end--> </div><!--问卷内容end-->

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # 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| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false