Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_aliyun_beta
jingquan huang 5 years ago
commit 5e0debec70

@ -314,8 +314,8 @@ class HomeworksService
if work.work_status != 0 if work.work_status != 0
if myshixun_endtime.present? if myshixun_endtime.present?
work.cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i work_cost_time = myshixun_endtime.to_i - setting_time.publish_time.to_i
work.cost_time = work_cost_time > 0 ? work_cost_time : games.select{|game| game.status == 2}.pluck(:cost_time).sum
efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0)) efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
work.efficiency = format("%.2f", efficiency) work.efficiency = format("%.2f", efficiency)

@ -1,18 +0,0 @@
json.question do
json.id question.id
json.question_number question.question_number
json.question_title question.question_title
json.question_type question.question_type
json.is_necessary question.is_necessary
if question.question_type == 2
json.max_choices question.max_choices
json.min_choices question.min_choices
end
json.answers do
json.array! answers do | a|
json.answer_id a.id
json.answer_position a.choice_position
json.answer_text a.choice_text.nil? ? "other_choices" : a.choice_text ##
end
end
end

@ -28,9 +28,24 @@ else
json.q_mains @poll_question_mains json.q_mains @poll_question_mains
end end
json.questions do json.questions @exercise_questions do | question|
json.array! @exercise_questions do | question| json.question do
json.partial! "exercise_banks/poll_questions", question: question, answers: question.exercise_bank_choices json.id question.id
json.question_number question.question_number
json.question_title question.question_title
json.question_type question.question_type
json.is_necessary question.is_necessary
if question.question_type == 2
json.max_choices question.max_choices
json.min_choices question.min_choices
end
json.answers do
json.array! question.exercise_bank_choices do | a|
json.answer_id a.id
json.answer_position a.choice_position
json.answer_text a.choice_text.nil? ? "other_choices" : a.choice_text ##
end
end
end end
end end
end end

@ -1,9 +1,14 @@
json.count @count json.count @count
json.course_list @course_lists, partial: 'users/question_banks/shared/course_list', as: :course_list json.course_list @course_lists, partial: 'users/question_banks/shared/course_list', as: :course_list
json.question_banks do
json.array! @question_banks do |question_bank| json.question_banks @question_banks do |question_bank|
json.partial! 'users/question_banks/shared/question_bank', locals: { question_bank: question_bank } json.id question_bank.id
json.name question_bank.name
json.is_public question_bank.is_public
json.quotes_count question_bank.quotes
json.creator_name question_bank.user.name
json.course_list_name question_bank.course_list.name
json.updated_at question_bank.updated_at
json.solve_count @solve_count_map.fetch(question_bank.id, 0) json.solve_count @solve_count_map.fetch(question_bank.id, 0)
end
end end

Loading…
Cancel
Save