diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6033da125..0c8b6dd07 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -375,12 +375,12 @@ module ApplicationHelper # 定义实训相关方法 def sum_final_score - Game.find_by_sql("SELECT sum(final_score) as total_score FROM `games` where user_id=#{User.current.id}").first.try(:total_score) + Game.find_by_sql("SELECT sum(final_score) as total_score FROM `games` where user_id=#{User.current.id}").first end # 获取某个myshixun的得分 def sum_myshixun_score myshixun_id - Game.find_by_sql("SELECT sum(final_score) as total_score FROM `games` where myshixun_id=#{myshixun_id}").first.try(:total_score) + Game.find_by_sql("SELECT sum(final_score) as total_score FROM `games` where myshixun_id=#{myshixun_id}").first end # myshixun 最高分