From 5ca5f67d56a85aa40925fb35b83619415039ef1e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 30 Aug 2019 16:04:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=95=88=E6=9E=9C=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- app/views/games/picture_display.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index d97b7172c..77e1eee7d 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -440,7 +440,7 @@ class SubjectsController < ApplicationController # 用户进展和获取的标签 def user_subject_progress challenge_ids - pass_games = Game.select(:id, :cost_time, :challenge_id).where(status: 2, user_id: current_user.id, challenge_id: challenge_ids) if current_user.logged? + pass_games = Challenge.left_joins(:games).where(challenges: {id: challenge_ids},games: {status: 2, user_id: current_user.id}) if current_user.logged? @all_score = Challenge.where(id: challenge_ids).sum(:score) # 如果没有通关的,没必要再继续统计了 diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder index eb2309f9b..7fdc2cfc1 100644 --- a/app/views/games/picture_display.json.jbuilder +++ b/app/views/games/picture_display.json.jbuilder @@ -19,7 +19,7 @@ if @type == "image" end elsif @type == "html" - json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe + json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe if @user_picture[0].present? elsif @type == "txt" json.contents @contents.to_s elsif @type =="qrcode"