diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 5f93bc36b..163ba1847 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -77,7 +77,7 @@ class GamesController < ApplicationController # 区分选择题和编程题,st:0编程题; if @st == 0 - has_answer = game_challenge.challenge_answers.size == 0 ? false : true + has_answer = game_challenge.challenge_answers.size != 0 game_challenge.answer = nil mirror_name = @shixun.mirror_name @@ -87,7 +87,7 @@ class GamesController < ApplicationController rescue uid_logger("实训平台繁忙,繁忙等级(81)") end - tpm_cases_modified = (game_challenge.modify_time != @game.modify_time ? true : false) # modify_time 决定TPM测试集是否有更新 + tpm_cases_modified = (game_challenge.modify_time != @game.modify_time) # modify_time 决定TPM测试集是否有更新 @task_result = {tpm_modified: tpm_modified, tpm_cases_modified: tpm_cases_modified, mirror_name: mirror_name, has_answer: has_answer} @@ -629,7 +629,7 @@ class GamesController < ApplicationController # user_answer虽然是传的数组,但是可能存在多选择提的情况. user_answer_tran = user_answer[index].size > 1 ? user_answer[index].split("").sort.join("") : user_answer[index] standard_answer_tran = choose.standard_answer.size > 1 ? choose.standard_answer.split("").sort.join("") : choose.standard_answer - correct = (user_answer_tran == standard_answer_tran) ? true : false + correct = (user_answer_tran == standard_answer_tran) if str.present? str += "," end diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 95fbf8200..f4549d691 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -278,7 +278,6 @@ class MyshixunsController < ApplicationController end end - if game.status == 2 @resubmit = Time.now.to_i end diff --git a/db/migrate/20190708062910_add_index_for_run_code_message.rb b/db/migrate/20190708062910_add_index_for_run_code_message.rb new file mode 100644 index 000000000..4449d58a2 --- /dev/null +++ b/db/migrate/20190708062910_add_index_for_run_code_message.rb @@ -0,0 +1,5 @@ +class AddIndexForRunCodeMessage < ActiveRecord::Migration[5.2] + def change + add_index :run_code_messages, :game_id + end +end