Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project
This commit is contained in:
commit
e0739d5d57
|
@ -98,7 +98,7 @@ class GamesController < ApplicationController
|
||||||
testCode.store("testCode_#{index}",test_set.try(:output))
|
testCode.store("testCode_#{index}",test_set.try(:output))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
testCode = testCode.to_json
|
||||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||||
step = @game.stage
|
step = @game.stage
|
||||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}", :testCode => "#{testCode}"}
|
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}", :testCode => "#{testCode}"}
|
||||||
|
|
|
@ -35,12 +35,7 @@ class ShixunsController < ApplicationController
|
||||||
s = Trustie::Gitlab::Sync.new
|
s = Trustie::Gitlab::Sync.new
|
||||||
s.sync_user(User.current)
|
s.sync_user(User.current)
|
||||||
end
|
end
|
||||||
if @shixun.gpid
|
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
||||||
gshixun = g.project(@shixun.gpid)
|
|
||||||
else
|
|
||||||
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
|
||||||
end
|
|
||||||
|
|
||||||
if gshixun.id
|
if gshixun.id
|
||||||
myshixun = copy_myshixun(@shixun, gshixun)
|
myshixun = copy_myshixun(@shixun, gshixun)
|
||||||
challenges = @shixun.challenges
|
challenges = @shixun.challenges
|
||||||
|
|
|
@ -46,13 +46,13 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
# 正在进行中任务
|
# 正在进行中任务
|
||||||
def shixun_running shixun
|
def shixun_running shixun, position
|
||||||
Myshixun.where(:parent_id => shixun, :status => 0).count
|
Myshixun.find_by_sql("SELECT * FROM `myshixuns` ms, `games` g where g.myshixun_id = ms.id and parent_id =#{shixun.id} and g.stage=#{position} and (g.status=0 or g.status=1);").count
|
||||||
end
|
end
|
||||||
|
|
||||||
# 已完成任务
|
# 已完成任务
|
||||||
def shixun_done shixun
|
def shixun_done shixun, position
|
||||||
Myshixun.where(:parent_id => shixun, :status => 1).count
|
Myshixun.find_by_sql("SELECT * FROM `myshixuns` ms, `games` g where g.myshixun_id = ms.id and parent_id =#{shixun.id} and g.stage=#{position} and g.status=2;").count
|
||||||
end
|
end
|
||||||
|
|
||||||
# 测评次数
|
# 测评次数
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Game < ActiveRecord::Base
|
class Game < ActiveRecord::Base
|
||||||
# stauts 0: can exe 1:doing 2:successed 3:locked
|
# stauts 0: can exe 1:doing 2:successed 3:locked
|
||||||
default_scope :order => 'stage'
|
default_scope :order => 'stage'
|
||||||
attr_accessible :description, :myshixun_id, :stage, :subject, :user_id, :status, :ready_knowledge, :task_pass, :answer, :score, :final_score
|
attr_accessible :description, :myshixun_id, :stage, :subject, :user_id, :status, :ready_knowledge, :task_pass, :answer, :score, :final_score, :path
|
||||||
belongs_to :myshixun,:touch=> true
|
belongs_to :myshixun,:touch=> true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_many :outputs, :dependent => :destroy
|
has_many :outputs, :dependent => :destroy
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<h4 class="fl panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red mr10">第<%= challenge.position %>关</span>
|
<h4 class="fl panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red mr10">第<%= challenge.position %>关</span>
|
||||||
<%= link_to challenge.subject, shixun_challenge_path(@shixun.id, challenge), :target => "_blank" %>
|
<%= link_to challenge.subject, shixun_challenge_path(@shixun.id, challenge), :target => "_blank" %>
|
||||||
</h4>
|
</h4>
|
||||||
|
<% if User.current.manager_of_shixun?(@shixun) %>
|
||||||
<p class="fr" style="display: none" id="shixun_icon_<%= index %>">
|
<p class="fr" style="display: none" id="shixun_icon_<%= index %>">
|
||||||
<% unless challenge.position < 2 %>
|
<% unless challenge.position < 2 %>
|
||||||
<a href="<%= index_up_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="上移" data-remote="true"><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
|
<a href="<%= index_up_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="上移" data-remote="true"><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
|
||||||
|
@ -23,13 +24,14 @@
|
||||||
<!-- <a href="#" title="删除" ><i class="fa fa-trash-o color-grey font-16 mr5" ></i></a>-->
|
<!-- <a href="#" title="删除" ><i class="fa fa-trash-o color-grey font-16 mr5" ></i></a>-->
|
||||||
<!--<a href="#" title="排名" ><i class="fa fa-signal color-grey font-16 mr5 " ></i></a>-->
|
<!--<a href="#" title="排名" ><i class="fa fa-signal color-grey font-16 mr5 " ></i></a>-->
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p class="ml15 mt15 color-grey">
|
<p class="ml15 mt15 color-grey">
|
||||||
<% if shixun_running(@shixun) != 0 %>
|
<% if shixun_running(@shixun, challenge.position) != 0 %>
|
||||||
<span class=" mr10">正在挑战:<%= shixun_running @shixun %></span>
|
<span class=" mr10">正在挑战:<%= shixun_running(@shixun, challenge.position) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if shixun_done(@shixun) != 0 %>
|
<% if shixun_done(@shixun, challenge.position) != 0 %>
|
||||||
<span class=" mr10">完成挑战:<%= shixun_done @shixun %></span>
|
<span class=" mr10">完成挑战:<%= shixun_done(@shixun, challenge.position) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if top_score(@shixun, challenge.position).score.to_i != 0 %>
|
<% if top_score(@shixun, challenge.position).score.to_i != 0 %>
|
||||||
<span class=" mr10">最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分</span>
|
<span class=" mr10">最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分</span>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<ul class="rightbar-score fr" >
|
<ul class="rightbar-score fr" >
|
||||||
<!--<li><i class="fa fa-signal font-14 mr5"></i>排名:<a href="#" class="">123</a></li>-->
|
<!--<li><i class="fa fa-signal font-14 mr5"></i>排名:<a href="#" class="">123</a></li>-->
|
||||||
<li><i class="fa fa-trophy font-14 mr5"></i>积分:<a class=""><%= shixun_final_score(@myshixun).first.try(:score) %></a></li>
|
<li><i class="fa fa-trophy font-14 mr5"></i>积分:<a class=""><%= shixun_final_score(@myshixun).first.try(:score) %></a></li>
|
||||||
<li><i class="fa fa-clock-o font-14 mr5"></i>耗时:<a class=""><%= game_avg_hour(@game.created_at, @game.updated_at) %>:<%= game_avg_min(@game.created_at, @game.updated_at) %></a></li>
|
<!--<li><i class="fa fa-clock-o font-14 mr5"></i>耗时:<a class=""><%#= game_avg_hour(@game.created_at, @game.updated_at) %>:<%#= game_avg_min(@game.created_at, @game.updated_at) %></a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -173,3 +173,5 @@ input.knowledge_frame{height:30px;line-height:30px;border:none;background:#f3f5f
|
||||||
|
|
||||||
.autoscroll_new{ overflow:auto; }
|
.autoscroll_new{ overflow:auto; }
|
||||||
.autoscroll_extend{ overflow:auto; }
|
.autoscroll_extend{ overflow:auto; }
|
||||||
|
.ke-edit-iframe{line-height: 1.9;}
|
||||||
|
.task-bg-grey{line-height: 1.9;}
|
||||||
|
|
Loading…
Reference in New Issue