From 06b346a11182665ec341b20c5d9441616c57bd47 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 12 Nov 2019 20:45:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E7=AD=94=E6=A1=88?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/myshixuns_helper.rb | 4 ++-- app/views/myshixuns/challenges.json.jbuilder | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/myshixuns_helper.rb b/app/helpers/myshixuns_helper.rb index e643555e1..47f863ccb 100644 --- a/app/helpers/myshixuns_helper.rb +++ b/app/helpers/myshixuns_helper.rb @@ -12,7 +12,7 @@ module MyshixunsHelper end end - def view_answer_time game, user_id - game.game_answers.where(user_id: user_id).last&.view_time + def view_answer_time game + game.game_answers.where(user_id: game.user_id).last&.view_time end end diff --git a/app/views/myshixuns/challenges.json.jbuilder b/app/views/myshixuns/challenges.json.jbuilder index e16896451..36fb1f692 100644 --- a/app/views/myshixuns/challenges.json.jbuilder +++ b/app/views/myshixuns/challenges.json.jbuilder @@ -6,6 +6,6 @@ json.array! @games do |game| json.identifier get_game_identifier(@shixun.task_pass, game, @identity) json.get_gold game.user_get_gold_and_experience(@shixun.status, challenge)[0] json.get_experience game.user_get_gold_and_experience(@shixun.status, challenge)[1] - json.view_answer_time view_answer_time(game, current_user.id) + json.view_answer_time view_answer_time(game) json.finished_time game.end_time end \ No newline at end of file From 2df4ff1f78a8bceb2e94b87971d349ffdfe41a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=B1=9F?= Date: Tue, 12 Nov 2019 21:18:09 +0800 Subject: [PATCH 2/2] add view_time property --- public/react/src/modules/page/main/LeftViewContainer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/page/main/LeftViewContainer.js b/public/react/src/modules/page/main/LeftViewContainer.js index e53eaa92c..f7c2d0311 100644 --- a/public/react/src/modules/page/main/LeftViewContainer.js +++ b/public/react/src/modules/page/main/LeftViewContainer.js @@ -305,7 +305,8 @@ class LeftViewContainer extends Component { id: item.answer_id, name: item.answer_name, score: item.answer_score, - contents: item.answer_contents + contents: item.answer_contents, + view_time: item.view_time } }) newAnswers.forEach((item, index) => { @@ -558,7 +559,7 @@ class LeftViewContainer extends Component { // /shixuns/mnf6b7z3/shixun_discuss?challenge_id=88 render() { const { challenge } = this.props - const { tabIndex } = this.state; + const { tabIndex } = this.state; return (