diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 3b06d8ef7..e680065fd 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -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 diff --git a/app/models/game.rb b/app/models/game.rb index 3649cc073..4ebd6474d 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -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 diff --git a/app/views/games/_myshixun_breadcrumbs.html.erb b/app/views/games/_myshixun_breadcrumbs.html.erb index 85069f449..dc558edbb 100644 --- a/app/views/games/_myshixun_breadcrumbs.html.erb +++ b/app/views/games/_myshixun_breadcrumbs.html.erb @@ -16,11 +16,5 @@ / <%= 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 %> - / - <%= 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 %> diff --git a/app/views/games/_myshixun_repository.html.erb b/app/views/games/_myshixun_repository.html.erb index b421c8b12..b292bd0ab 100644 --- a/app/views/games/_myshixun_repository.html.erb +++ b/app/views/games/_myshixun_repository.html.erb @@ -13,7 +13,7 @@
<% if params[:action] == "entry" || @file_open %>
- <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> + <%= render :partial => 'games/file_edit_form', :locals => {:filename => @path, :content => @content} %>
<% else %> <% unless @entries.blank? %>