From 9660025ba333da76021e7c310c0c9b0b9b4e2d18 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 17 Oct 2017 09:25:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E8=AE=AD=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 最高分