Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b5d7e02eae | |
|
|
3544116bef | |
|
|
201b072b33 | |
|
|
89d2645d3d | |
|
|
23be8a127f | |
|
|
5bc63e9525 | |
|
|
2116ce54e5 | |
|
|
4417783f3f | |
|
|
75c23289a3 |
|
|
@ -39,6 +39,9 @@ class GamesController < ApplicationController
|
|||
@game_challenge = @game.challenge
|
||||
@challenges = Challenge.where(:shixun_id => @myshixun.shixun_id)
|
||||
@shixun = @myshixun.shixun
|
||||
# 判断tpm是否修改了
|
||||
@tpm_modified = tpm_is_modified(@myshixun.try(:gpid), @shixun.try(:gpid))
|
||||
# end
|
||||
@praise_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "Challenge").count
|
||||
@tread_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "ChallengeTread").count
|
||||
# @games_count = @games.count
|
||||
|
|
@ -142,6 +145,38 @@ class GamesController < ApplicationController
|
|||
=end
|
||||
end
|
||||
|
||||
# 同步更新最新代码
|
||||
def sync_codes
|
||||
# 获取某次提交后之后修改的文件路径
|
||||
get ":id/repository/get_after_paths" do
|
||||
# 某个文件的修改记录,只需对比当前的文件有没有改动,有改动重置当前的文件
|
||||
# 重置某一个文件的代码?
|
||||
# 如果该文件改动了,则重置该文件(git reset),没改动则直接拉取(git pull)
|
||||
path = `git #{git_tree} log #{ref} file_name --pretty=oneline -1`
|
||||
git checkout hash path
|
||||
# 某次提交后的修改文件目录路径数
|
||||
|
||||
|
||||
git_tree = params[:git_tree]
|
||||
ref = params[:ref_name]
|
||||
commit_id = `git #{git_tree} log #{ref} --pretty=oneline -1`
|
||||
commit_id2 = `--git #{git_tree} rev-parse #{ref}`
|
||||
{commit_id: commit_id.rstrip, commit_id2: commit_id2}
|
||||
end
|
||||
# end
|
||||
|
||||
# gitlab版本
|
||||
get ":id/repository/get_branch_commit_id" do
|
||||
git_tree = params[:git_tree]
|
||||
ref = params[:ref_name]
|
||||
commit_id = `git #{git_tree} log #{ref} --pretty=oneline -1`
|
||||
commit_id2 = `--git #{git_tree} rev-parse #{ref}`
|
||||
{commit_id: commit_id.rstrip, commit_id2: commit_id2}
|
||||
end
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
# json调用,显示左边的隐藏具体详情@game 字段 msg
|
||||
# 刷新右边的输出结果 @game out_put
|
||||
def outputs_show
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ module ApplicationHelper
|
|||
extend Forwardable
|
||||
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
||||
|
||||
# 判断TPM的代码是否被修改了
|
||||
def tpm_is_modified myshixun_gpid, shixun_gpid
|
||||
g = Gitlab.client
|
||||
# myshixun取最后一天,shixun取最新一条
|
||||
myshixun_commit_id = g.commits(myshixun_gpid).first.try(:id)
|
||||
shixun_commit_id = g.commits(shixun_gpid).first.try(:id)
|
||||
result = myshixun_commit_id == shixun_commit_id ? true :false
|
||||
return result
|
||||
end
|
||||
|
||||
# 定义当前关卡是否有权开启下一关
|
||||
# :实训若发布了,必须通过当前关卡才能查看下一关
|
||||
# :未发布的实训,除了最后一关,其它的关卡都可以进入下一关
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
# encoding: utf-8
|
||||
module GamesHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<% end %>
|
||||
<li id="tab_nav_4">
|
||||
<a href="<%= shixun_discuss_shixun_path(@myshixun.shixun, :challenge_id => @game_challenge.id) %>" class="tab_type" style="font-size: 16px" data-remote="true">
|
||||
评论<span id="discusses_count" class="edu-cir-grey1" style="line-height: 18px!important;"><%= @discusses_count if @discusses_count > 0%></span>
|
||||
评论<span id="discusses_count" class="edu-cir-grey1" style="line-height: 18px!important;"><%= @discusses_count if @discusses_count.to_i > 0%></span>
|
||||
</a>
|
||||
<%#= link_to '', shixun_discuss_shixun_path(@myshixun.shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'minus_score'
|
||||
get 'refresh_game_list'
|
||||
get 'waiting_info'
|
||||
get 'sync_codes'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue