Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project

This commit is contained in:
daiao 2017-03-30 10:06:06 +08:00
commit c5c229ca30
4 changed files with 7 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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 %>

View File

@ -13,7 +13,7 @@
<div class="content-editor-inner" id="repository_contents_show">
<% if params[:action] == "entry" || @file_open %>
<div id="file_entry_content">
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<%= render :partial => 'games/file_edit_form', :locals => {:filename => @path, :content => @content} %>
</div>
<% else %>
<% unless @entries.blank? %>