下一关修正
This commit is contained in:
parent
50caa50898
commit
d4aac72822
|
@ -12,7 +12,7 @@ class ShixunsController < ApplicationController
|
|||
def shixun_monitor
|
||||
monitor_filter
|
||||
if @had_exec
|
||||
@tpm = Myshixun.where(:user_id => User.current, :parent_id => @shixun).first
|
||||
@tpm = Myshixun.where(:user_id => User.current, :shixun_id => @shixun).first
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
@ -188,8 +188,9 @@ class ShixunsController < ApplicationController
|
|||
pipeLine = "#{Base64.encode64(shixun.script)}"
|
||||
params = {jobName: "myshixun_#{myshixun.id}", pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
Repository.create!(:myshixun_id => myshixun.id, :type => "Repository::Gitlab", :identifier => gshixun.name,
|
||||
:project_id => -1, :shixun_id => -2)
|
||||
rep = Repository.new(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
|
||||
rep.type = "Repository::Gitlab"
|
||||
rep.save!
|
||||
if (res && res['code'] != 0)
|
||||
raise("Job 创建失败")
|
||||
end
|
||||
|
|
|
@ -10,7 +10,8 @@ class Game < ActiveRecord::Base
|
|||
has_many :challenge_samples, :dependent => :destroy
|
||||
|
||||
def next_game
|
||||
game = Game.where(:myshixun_id => self.myshixun_id, :stage => self.stage + 1).first
|
||||
challenge = self.challenge
|
||||
game = Game.where(:myshixun_id => self.myshixun_id, :stage => challenge.try(:position) + 1).first
|
||||
render_404 if game.nil?
|
||||
return game
|
||||
end
|
||||
|
|
|
@ -16,11 +16,5 @@
|
|||
<span class="c_grey">/</span> <%= link_to h(dir), {:action => 'show', :id => @game, :myshixun_id => @myshixun, :path => to_path_param(link_path), :rev => @rev},
|
||||
:remote => true, :class => "f14 fb" %>
|
||||
<% end %>
|
||||
<% if filename %>
|
||||
<span class="c_grey">/</span>
|
||||
<%= link_to h(filename), {:action => 'changes', :id => @shixun, :repository_id => @repository.identifier_param,
|
||||
:path => to_path_param("#{link_path}/#{filename}"), :rev => @rev}, :class => "f14 fb" %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue