From dbd3ed3f18140557d83768a96db48d8fdde2bd2c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 28 Jul 2017 20:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=8F=E9=AA=8C=E5=80=BC?= =?UTF-8?q?=E5=92=8C=E9=87=91=E5=B8=81=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 3 ++- app/views/challenges/edit.html.erb | 1 - app/views/games/_choice_question.html.erb | 4 ++-- app/views/games/_code_actions.html.erb | 2 ++ app/views/myshixuns/_myshixun_top.html.erb | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 00065036c..d4bb929e5 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -284,10 +284,11 @@ class GamesController < ApplicationController correct = false end @game.update_attributes(:status => 2, :end_time => Time.now) + User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score)) if correct if @game.outputs.blank? Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct) end - render :json => {correct: correct, had_done: had_done} + render :json => {correct: correct, had_done: had_done, :grade => User.current.grade} end diff --git a/app/views/challenges/edit.html.erb b/app/views/challenges/edit.html.erb index 0c130747a..f369011ed 100644 --- a/app/views/challenges/edit.html.erb +++ b/app/views/challenges/edit.html.erb @@ -40,7 +40,6 @@ +编程任务 +多选任务 +单选任务 - <% end %> diff --git a/app/views/games/_choice_question.html.erb b/app/views/games/_choice_question.html.erb index fcba26c7d..82176ddd7 100644 --- a/app/views/games/_choice_question.html.erb +++ b/app/views/games/_choice_question.html.erb @@ -1,12 +1,12 @@
" id="correct_tip"> 正确 diff --git a/app/views/games/_code_actions.html.erb b/app/views/games/_code_actions.html.erb index 207228119..d05cc5950 100644 --- a/app/views/games/_code_actions.html.erb +++ b/app/views/games/_code_actions.html.erb @@ -94,6 +94,7 @@ $("#code_test").remove(); if(data.correct){ $("#correct_tip").show(); + $("#user_grade").html(data.grade); if( data.had_done == 0 ) { $("#code_estimate").html("下一关"); var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>"; @@ -103,6 +104,7 @@ } // 传递具体屏幕的宽高,实现不同浏览器与不同分辨率都能撑满屏幕 pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight); + }else{ $("#error_tip").show(); $("#code_estimate").html("下一关"); diff --git a/app/views/myshixuns/_myshixun_top.html.erb b/app/views/myshixuns/_myshixun_top.html.erb index 641a3d603..12420af90 100644 --- a/app/views/myshixuns/_myshixun_top.html.erb +++ b/app/views/myshixuns/_myshixun_top.html.erb @@ -6,7 +6,7 @@