|
|
|
@ -613,13 +613,10 @@ class GamesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 批量插入评测结果
|
|
|
|
|
uid_logger("choose_build")
|
|
|
|
|
uid_logger("#------------chooice score: #{score}")
|
|
|
|
|
sql = "INSERT INTO outputs (game_id, test_set_position, actual_output, result, query_index, created_at, updated_at) VALUES" + str
|
|
|
|
|
ActiveRecord::Base.connection.execute sql
|
|
|
|
|
|
|
|
|
|
had_done = @game.had_done
|
|
|
|
|
@myshixun.update_attribute(:status, 1) if had_done == 1
|
|
|
|
|
|
|
|
|
|
# 没通关或者查看了答案通关的时候经验为0
|
|
|
|
|
# 通关但是查看了答案,评测的时候金币显示0(避免用户以为重复扣除),但是在关卡列表中金币显示负数
|
|
|
|
|
experience = 0
|
|
|
|
@ -629,7 +626,8 @@ class GamesController < ApplicationController
|
|
|
|
|
if had_passed && !@game.had_passed?
|
|
|
|
|
@game.update_attributes(:status => 2, :end_time => Time.now)
|
|
|
|
|
# TPM实训已发布并且没有查看答案
|
|
|
|
|
if @shixun.is_published? && !@game.answer_open
|
|
|
|
|
if @shixun.is_published? && @game.answer_open == 0
|
|
|
|
|
uid_logger("@@@@@@@@@@@@@@@@@chooice score: #{score}")
|
|
|
|
|
# 查看答案的时候处理final_scor和扣分记录
|
|
|
|
|
experience = score
|
|
|
|
|
reward_attrs = { container_id: @game.id, container_type: 'Game', score: score }
|
|
|
|
@ -638,6 +636,8 @@ class GamesController < ApplicationController
|
|
|
|
|
final_score = score
|
|
|
|
|
RewardExperienceService.call(@myshixun.owner, reward_attrs)
|
|
|
|
|
end
|
|
|
|
|
had_done = @game.had_done
|
|
|
|
|
@myshixun.update_attribute(:status, 1) if had_done == 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
grade = @myshixun.owner.try(:grade)
|
|
|
|
|