games一些修改
This commit is contained in:
parent
62fe591438
commit
c8c3b6188c
|
@ -90,6 +90,11 @@ class GamesController < ApplicationController
|
|||
def game_status
|
||||
@outputs = @game.outputs
|
||||
@latest_output = @game.latest_output.try(:out_put)
|
||||
# if @game.status == 1 || @game.status == 1
|
||||
#
|
||||
# else
|
||||
#
|
||||
# end
|
||||
render :json => {status: @game.status}
|
||||
end
|
||||
|
||||
|
|
|
@ -15,13 +15,13 @@ class MyshixunsController < ApplicationController
|
|||
message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
||||
game = Game.find(task_id)
|
||||
if status == 0
|
||||
game_outputs = Output.create(:code => status, :msg => nil, :game_id => task_id, :out_put => outPut)
|
||||
game.update_attribute(:status, 2)
|
||||
game.update_attribute(:final_score, game.score)
|
||||
message = nil
|
||||
else
|
||||
game_outputs = Output.create(:code => status, :msg => nil, :game_id => task_id, :out_put => outPut)
|
||||
game.update_attribute(:status, 0)
|
||||
end
|
||||
game_outputs = GameOutputs.create(:code => status, :msg => message, :game_id => task_id, :out_put => outPut)
|
||||
render :json => {:data => "success"}
|
||||
end
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class ShixunsController < ApplicationController
|
|||
format.html{redirect_to myshixun_path(myshixun)}
|
||||
end
|
||||
rescue Exception => e
|
||||
flash[:error] = l(:notice_email_invited)
|
||||
raise ActiveRecord::Rollback
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
@ -68,7 +69,7 @@ class ShixunsController < ApplicationController
|
|||
def create
|
||||
@shixun = Shixun.new(params[:shixun])
|
||||
@shixun.user_id = User.current.id
|
||||
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
|
||||
(params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false)
|
||||
respond_to do |format|
|
||||
if @shixun.save
|
||||
m = ShixunMember.new(:user_id => User.current.id, :role => 1)
|
||||
|
|
|
@ -47,11 +47,7 @@
|
|||
<h3 >测试输出</h3>
|
||||
</div>
|
||||
<div class="content-history-inner">
|
||||
<% unless @outputs.blank? %>
|
||||
<% @outputs.each do |output| %>
|
||||
<%= output.out_put %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= @game.outputs.first.try(:out_put) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-width fl content-submit ml19 mt15">
|
||||
|
@ -67,7 +63,7 @@
|
|||
<! }else if(status == 1){ !>
|
||||
<a class="task-btn mb10">评测中..</a>
|
||||
<! }else if(status == 2){ !>
|
||||
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :onclick => "training_task_submmit();", :remote => true %>
|
||||
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :remote => true %>
|
||||
<! } !>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<li class="mb5 ml70">
|
||||
<label > 公开 :</label>
|
||||
<%= f.text_field :is_public, :id => "project_is_public", :name => "shixun[is_public]", :type => "checkbox", :value => "1", :checked => "checked" %>
|
||||
<span class="c_grey">(打钩为公开项目,不打钩为私有项目;私有项目仅项目成员可见。)</span>
|
||||
<span class="c_grey">(打钩为公开实训,不打钩为私有项目;私有项目仅项目成员可见。)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
|
|
Loading…
Reference in New Issue