正式版报500

This commit is contained in:
cxt 2015-12-15 20:15:10 +08:00
parent 699d0e22dd
commit 481b7b96eb
3 changed files with 9 additions and 7 deletions

View File

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

View File

@ -32,7 +32,7 @@
<div>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= 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 %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
@ -64,7 +64,7 @@
<div>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= 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%>
</div>
<div class="cl"></div>
<div class="ur_inputs">

View File

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