From 481b7b96eb0783a97d6a3cb6b51463b86ab212d2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Dec 2015 20:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=89=88=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 8 ++++---- app/views/exercise/_exercise_teacher.html.erb | 4 ++-- db/schema.rb | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 73da3b9c4..3ed5886e7 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -359,7 +359,7 @@ class ExerciseController < ApplicationController if @exercise.end_time <= Time.now @course.student.each do |student| if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? - ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => false,:score=>0) + ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) end s_score = calculate_student_score(@exercise, student.student) @@ -577,15 +577,15 @@ class ExerciseController < ApplicationController standard_answer = get_user_standard_answer(question, user) unless answer.empty? # 问答题有多个答案 - if question.question_type == 3 + if question.question_type == 3 && !standard_answer.empty? if standard_answer.include?(answer.first.answer_text) score1 = score1+ question.question_score unless question.question_score.nil? end - elsif question.question_type == 1 + elsif question.question_type == 1 && !standard_answer.nil? if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id score2 = score2 + question.question_score unless question.question_score.nil? end - else + elsif question.question_type == 2 && !standard_answer.nil? arr = get_mulscore(question, user) if arr.to_i == standard_answer.exercise_choice_id score3 = score3 + question.question_score unless question.question_score.nil? diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index 24687d28b..586c033a1 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -32,7 +32,7 @@
第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分)
- 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
@@ -64,7 +64,7 @@
第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分)
- 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first%>
diff --git a/db/schema.rb b/db/schema.rb index 9926f2876..51020f45d 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 => 20151215105425) do +ActiveRecord::Schema.define(:version => 20151215112107) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1161,6 +1161,7 @@ ActiveRecord::Schema.define(:version => 20151215105425) do t.datetime "updated_at", :null => false t.boolean "locked", :default => false t.integer "sticky", :default => 0 + t.integer "org_subfield_id" end create_table "org_member_roles", :force => true do |t| @@ -1187,6 +1188,7 @@ ActiveRecord::Schema.define(:version => 20151215105425) do t.string "name" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "field_type" end create_table "organizations", :force => true do |t|