From b63b4974ebb58fbbf28f19051f63a837ec1a6075 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 14 Jan 2015 16:36:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 4 +- app/views/poll/_choice_show.html.erb | 24 +++ app/views/poll/statistics_result.html.erb | 185 +--------------------- db/schema.rb | 52 +++++- 4 files changed, 83 insertions(+), 182 deletions(-) create mode 100644 app/views/poll/_choice_show.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 9177e044b..f9a07b134 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -76,11 +76,12 @@ class PollController < ApplicationController end def statistics_result + @poll_questions = PollQuestion.all respond_to do |format| format.html{render :layout => 'base_courses'} end end - + #添加单选题 def add_mc @@ -114,4 +115,5 @@ class PollController < ApplicationController def is_course_teacher render_403 unless(@course && User.current.allowed_to?(:as_teacher,@course)) end + end \ No newline at end of file diff --git a/app/views/poll/_choice_show.html.erb b/app/views/poll/_choice_show.html.erb new file mode 100644 index 000000000..a37ca148a --- /dev/null +++ b/app/views/poll/_choice_show.html.erb @@ -0,0 +1,24 @@ +
+ + + + + + + + <% poll_question.poll_answers.each do |poll_answer| %> + + + + + + <% end %> + + + + + + +
选项 小计 比例
<%= poll_answer.answer_text %> 24
75%
本题有效填写人次 26 
+
+ diff --git a/app/views/poll/statistics_result.html.erb b/app/views/poll/statistics_result.html.erb index 164020cde..f0f992c90 100644 --- a/app/views/poll/statistics_result.html.erb +++ b/app/views/poll/statistics_result.html.erb @@ -12,190 +12,17 @@

某问卷统计

- +<% @poll_questions.each do |poll_question| %>
  1. - 第1题:问题描述问题描述 [单选题] + 第1题:问题描述问题描述<%= poll_question.question_title %> [单选题]<% poll_question.poll_answers %>
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    -
    -
  2. -
  3. -
    - 第1题:问题描述问题描述 [单选题] -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    -
    -
  4. -
  5. -
    - 第1题:问题描述问题描述 [单选题] -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    -
    -
  6. -
  7. -
    - 第1题:问题描述问题描述 [单选题] -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    -
    -
  8. -
  9. -
    - 第1题:问题描述问题描述 [单选题] -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    -
    -
  10. + <%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %> +
+ <% end %>
@@ -205,8 +32,6 @@
- -
diff --git a/db/schema.rb b/db/schema.rb index 9c6f4eac3..627529a57 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 => 20150112024820) do +ActiveRecord::Schema.define(:version => 20150112090810) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -23,6 +23,18 @@ ActiveRecord::Schema.define(:version => 20150112024820) do add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + create_table "api_keys", :force => true do |t| + t.string "access_token" + t.datetime "expires_at" + t.integer "user_id" + t.boolean "active", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" + add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + create_table "applied_projects", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -1055,6 +1067,14 @@ ActiveRecord::Schema.define(:version => 20150112024820) do t.string "description" end + create_table "social_groups", :force => true do |t| + t.string "name" + t.text "description" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -1270,6 +1290,36 @@ ActiveRecord::Schema.define(:version => 20150112024820) do add_index "versions", ["project_id"], :name => "versions_project_id" add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + create_table "voting_choices", :force => true do |t| + t.integer "poll_id", :null => false + t.string "text", :null => false + t.datetime "created_on", :null => false + t.integer "position", :default => 1 + end + + add_index "voting_choices", ["poll_id"], :name => "choices_poll_id" + + create_table "voting_polls", :force => true do |t| + t.integer "project_id", :null => false + t.string "question", :null => false + t.datetime "created_on", :null => false + t.boolean "revote" + end + + add_index "voting_polls", ["project_id"], :name => "polls_project_id" + + create_table "voting_votes", :force => true do |t| + t.integer "user_id", :null => false + t.integer "poll_id", :null => false + t.integer "choice_id", :null => false + t.datetime "created_on", :null => false + end + + add_index "voting_votes", ["choice_id"], :name => "votes_choice_id" + add_index "voting_votes", ["poll_id"], :name => "votes_poll_id" + add_index "voting_votes", ["user_id", "poll_id"], :name => "votes_user_poll_unique", :unique => true + add_index "voting_votes", ["user_id"], :name => "votes_user_id" + create_table "watchers", :force => true do |t| t.string "watchable_type", :default => "", :null => false t.integer "watchable_id", :default => 0, :null => false