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

This commit is contained in:
daiao 2017-03-24 19:51:28 +08:00
commit e0739d5d57
7 changed files with 16 additions and 17 deletions

View File

@ -98,7 +98,7 @@ class GamesController < ApplicationController
testCode.store("testCode_#{index}",test_set.try(:output))
end
end
testCode = testCode.to_json
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
step = @game.stage
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}", :testCode => "#{testCode}"}

View File

@ -35,12 +35,7 @@ class ShixunsController < ApplicationController
s = Trustie::Gitlab::Sync.new
s.sync_user(User.current)
end
if @shixun.gpid
gshixun = g.project(@shixun.gpid)
else
gshixun = g.fork(@shixun.gpid, User.current.gid)
end
if gshixun.id
myshixun = copy_myshixun(@shixun, gshixun)
challenges = @shixun.challenges

View File

@ -46,13 +46,13 @@ module ApplicationHelper
end
# 正在进行中任务
def shixun_running shixun
Myshixun.where(:parent_id => shixun, :status => 0).count
def shixun_running shixun, position
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
# 已完成任务
def shixun_done shixun
Myshixun.where(:parent_id => shixun, :status => 1).count
def shixun_done shixun, position
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
# 测评次数

View File

@ -1,7 +1,7 @@
class Game < ActiveRecord::Base
# stauts 0: can exe 1doing 2successed 3:locked
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 :user
has_many :outputs, :dependent => :destroy

View File

@ -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>
<%= link_to challenge.subject, shixun_challenge_path(@shixun.id, challenge), :target => "_blank" %>
</h4>
<% if User.current.manager_of_shixun?(@shixun) %>
<p class="fr" style="display: none" id="shixun_icon_<%= index %>">
<% 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>
@ -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-signal color-grey font-16 mr5 " ></i></a>-->
</p>
<% end %>
<div class="cl"></div>
<p class="ml15 mt15 color-grey">
<% if shixun_running(@shixun) != 0 %>
<span class=" mr10">正在挑战:<%= shixun_running @shixun %></span>
<% if shixun_running(@shixun, challenge.position) != 0 %>
<span class=" mr10">正在挑战:<%= shixun_running(@shixun, challenge.position) %></span>
<% end %>
<% if shixun_done(@shixun) != 0 %>
<span class=" mr10">完成挑战:<%= shixun_done @shixun %></span>
<% if shixun_done(@shixun, challenge.position) != 0 %>
<span class=" mr10">完成挑战:<%= shixun_done(@shixun, challenge.position) %></span>
<% end %>
<% if top_score(@shixun, challenge.position).score.to_i != 0 %>
<span class=" mr10">最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分</span>

View File

@ -4,7 +4,7 @@
<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-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>
</div>
<script>

View File

@ -173,3 +173,5 @@ input.knowledge_frame{height:30px;line-height:30px;border:none;background:#f3f5f
.autoscroll_new{ overflow:auto; }
.autoscroll_extend{ overflow:auto; }
.ke-edit-iframe{line-height: 1.9;}
.task-bg-grey{line-height: 1.9;}