Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
77741cf52c
|
@ -28,7 +28,7 @@
|
||||||
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||||
<% if student_work.created_at && @homework.end_time%>
|
<% if student_work.created_at && @homework.end_time%>
|
||||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
|
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
||||||
<span class="c_red">[迟交]</span>
|
<span class="c_red">[迟交]</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
|
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
||||||
<span class="c_red">[迟交]</span>
|
<span class="c_red">[迟交]</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% if test.status.to_i == -2 %>
|
<% if test.status.to_i == -2 %>
|
||||||
<div class="ProResultCon "><%= test.results.first %></div>
|
<div class="ProResultCon"><pre><%= test.results.first %></pre></div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="ProResultTable " >
|
<div class="ProResultTable " >
|
||||||
<ul class="ProResultUl " >
|
<ul class="ProResultUl " >
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% if test.status.to_i == -2 %>
|
<% if test.status.to_i == -2 %>
|
||||||
<div class="ProResultCon "><%= test.results.first %></div>
|
<div class="ProResultCon"><pre><%= test.results.first %></pre></div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="ProResultTable " >
|
<div class="ProResultTable " >
|
||||||
<ul class="ProResultUl " >
|
<ul class="ProResultUl " >
|
||||||
|
|
|
@ -8,4 +8,15 @@ namespace :rep_fault do
|
||||||
rep.save
|
rep.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "forge and ossean's members"
|
||||||
|
task :sync_members => :environment do
|
||||||
|
projects = []
|
||||||
|
projects << Project.where("id =? ",2)
|
||||||
|
projects << Project.where("id =? ",299)
|
||||||
|
puts projects
|
||||||
|
s = Trustie::Gitlab::Sync.new
|
||||||
|
projects.each do |project|
|
||||||
|
s.only_members(project.first)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -3,19 +3,27 @@
|
||||||
namespace :sync_rep do
|
namespace :sync_rep do
|
||||||
desc "sync some projects which just have sigle repository"
|
desc "sync some projects which just have sigle repository"
|
||||||
task :sigle => :environment do
|
task :sigle => :environment do
|
||||||
projects = Project.all
|
projects = Project.where("user_id !=?",12)
|
||||||
projects.each do |project|
|
projects.each do |project|
|
||||||
# 针对类型为Git并且只有一个版本库的项目
|
# 针对类型为Git并且只有一个版本库的项目
|
||||||
if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git"
|
if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git"
|
||||||
rep = project.repositories.first
|
rep = project.repositories.first
|
||||||
s = Trustie::Gitlab::Sync.new
|
count = Repository.find_by_sql("SELECT * FROM `repositories` where identifier = '#{rep.identifier}'").count
|
||||||
s.sync_project(project, path: rep.identifier, import_url: rep.url)
|
puts count
|
||||||
rep.type = 'Repository::Gitlab'
|
unless count > 1
|
||||||
rep.save
|
rep.identifier
|
||||||
puts "*************************************"
|
puts "################################"
|
||||||
puts project.id
|
puts project.id
|
||||||
puts rep.id
|
puts rep.id
|
||||||
puts rep.identifier
|
s = Trustie::Gitlab::Sync.new
|
||||||
|
s.sync_project(project, path: rep.identifier, import_url: rep.url)
|
||||||
|
rep.type = 'Repository::Gitlab'
|
||||||
|
rep.save
|
||||||
|
puts "*************************************"
|
||||||
|
puts project.id
|
||||||
|
puts rep.id
|
||||||
|
puts rep.identifier
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,6 +69,11 @@ module Trustie
|
||||||
|
|
||||||
# import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git
|
# import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git
|
||||||
# can use password
|
# can use password
|
||||||
|
puts "@@@@@@@@@@@@@@@@@@@@@@@"
|
||||||
|
puts path
|
||||||
|
puts project.description
|
||||||
|
puts gid
|
||||||
|
puts import_url
|
||||||
gproject = self.g.create_project(path,
|
gproject = self.g.create_project(path,
|
||||||
path: path,
|
path: path,
|
||||||
description: project.description,
|
description: project.description,
|
||||||
|
@ -81,6 +86,7 @@ module Trustie
|
||||||
user_id: gid,
|
user_id: gid,
|
||||||
import_url: import_url
|
import_url: import_url
|
||||||
)
|
)
|
||||||
|
puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||||
project.gpid = gproject.id
|
project.gpid = gproject.id
|
||||||
project.save!
|
project.save!
|
||||||
puts "Successfully created #{project.name}"
|
puts "Successfully created #{project.name}"
|
||||||
|
@ -100,6 +106,20 @@ module Trustie
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def only_members(project)
|
||||||
|
project.members.each do |m|
|
||||||
|
begin
|
||||||
|
gid = m.user.gid
|
||||||
|
unless gid
|
||||||
|
gid = sync_user(m.user).id
|
||||||
|
end
|
||||||
|
self.g.add_team_member(project.gpid, gid, UserLevel::DEVELOPER)
|
||||||
|
rescue => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def remove_project
|
def remove_project
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue