dev_forum
cxt 5 years ago
parent 46f21ceacc
commit 665791f472

@ -74,12 +74,12 @@ class Myshixun < ApplicationRecord
# 个人实训得分 # 个人实训得分
def total_score def total_score
self.games.select{|game| game.status = 2 && game.final_score > 0}.pluck(:final_score).sum.to_i self.games.select{|game| game.status == 2 && game.final_score > 0}.pluck(:final_score).sum.to_i
end end
# 个人通关数 # 个人通关数
def passed_count def passed_count
self.games.select{|game| game.status = 2}.size self.games.select{|game| game.status == 2}.size
end end
# 通关时间 # 通关时间
@ -94,7 +94,7 @@ class Myshixun < ApplicationRecord
# 通关总耗时 # 通关总耗时
def total_cost_time def total_cost_time
self.games.select{|game| game.status = 2}.map(&:cost_time).sum.to_i self.games.select{|game| game.status == 2}.map(&:cost_time).sum.to_i
end end
end end

Loading…
Cancel
Save