当前关卡方法修改;耗时修改
This commit is contained in:
parent
ce13880f96
commit
b18f0dd772
|
|
@ -203,16 +203,16 @@ class GamesController < ApplicationController
|
|||
shixun = @myshixun.shixun
|
||||
logger.info("##### resubmit_identifier is #{resubmit_identifier}")
|
||||
if params[:resubmit].blank? # 非重新评测
|
||||
@game.update_attribute(:end_time, Time.now)
|
||||
if had_done == 1 # 通过最后一关,即所有关卡
|
||||
@myshixun.update_attribute(:status, 1)
|
||||
else # 通过当前一关
|
||||
if @game.status == 2
|
||||
game_passed_code(@game.id, game_challenge.try(:path), @myshixun.try(:gpid), 1)
|
||||
if !@game.answer_open && shixun.status > 1
|
||||
reward_grade(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
reward_experience(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
end
|
||||
end
|
||||
# 通过当前一关
|
||||
if @game.status == 2
|
||||
@game.update_attribute(:end_time, Time.now)
|
||||
game_passed_code(@game.id, game_challenge.try(:path), @myshixun.try(:gpid), 1)
|
||||
if !@game.answer_open && shixun.status > 1
|
||||
reward_grade(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
reward_experience(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
end
|
||||
end
|
||||
game_status = @game.status
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class Myshixun < ActiveRecord::Base
|
|||
current_game = games.select{|game| game.status==1 || game.status==0}.first
|
||||
if current_game.blank?
|
||||
passed_games = games.select{|game| game.status==2}
|
||||
current_game = passed_games.last
|
||||
current_game = passed_games.first
|
||||
end
|
||||
return current_game
|
||||
end
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@
|
|||
function formatDuring(time){
|
||||
var days = parseInt(time / (1000 * 60 * 60 * 24));
|
||||
var hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
var minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60));
|
||||
var seconds = parseInt((time % (1000 * 60)) / 1000);
|
||||
var minutes = parseInt((time % (1000 * 60 * 60 * 24) % (1000 * 60 * 60))/ (1000 * 60));
|
||||
var seconds = parseInt((time % (1000 * 60 * 60 * 24) % (1000 * 60 * 60)) % (1000 * 60) / 1000);
|
||||
$("#time-consuming").html("耗时:" + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue