解决冲突

dev_course
daiao 6 years ago
commit 5f6e59d46c

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

@ -203,6 +203,7 @@ class HomeworkCommonsController < ApplicationController
if @work_excel.present?
student_work_to_xlsx(@work_excel,@homework)
exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S')
render xlsx: "#{exercise_export_name.strip.first(30)}",template: "homework_commons/works_list.xlsx.axlsx",locals:
{table_columns: @work_head_cells,task_users: @work_cells_column}
else

@ -56,19 +56,13 @@ class Myshixun < ApplicationRecord
# status:0 可以测评的,正在测评的
# 如果都完成,则当前任务为最后一个任务
def current_task
current_game = self.games.select{|game| game.status == 1 || game.status == 0}.first
games = self.games
current_game = games.select{|game| game.status == 1 || game.status == 0}.first
if current_game.blank?
if self.status == 1
logger.info("@3333333333344444444#{self.id}")
current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and
g.challenge_id = c.id and g.status = 2 order by c.position desc").first
else
# 如果没开启过的status都为3所以应该进入第一关
current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and
g.challenge_id = c.id and g.status = 3 order by c.position asc").first
end
current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id}
and g.challenge_id = c.id and g.status = 2 order by c.position desc").first
end
return current_game
current_game
end

Loading…
Cancel
Save