下一关的一些改进

This commit is contained in:
huang 2017-03-24 10:00:06 +08:00
parent c4ffa20461
commit a4bee495a2
2 changed files with 4 additions and 3 deletions

View File

@ -108,7 +108,8 @@ class GamesController < ApplicationController
# 自动推送下一个任务
def next_step
next_game = @game.next_game
next_game.update_attribute(:status, 0)
next_game.update_attribute(:status, 0) if next_game.status == 3
respond_to do |format|
format.js{redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)}
end

View File

@ -10,9 +10,9 @@ class Myshixun < ActiveRecord::Base
# 如果都完成,则当前任务为最后一个任务
def current_task
games = self.games
current_game = games.select{|game| game=[0,1]}.first
current_game = games.select{|game| game.status==1 || game.status==1}.first
if current_game.blank?
current_game = self.games.last
current_game = games.last
end
return current_game
end