From 88dc0070119d7a97424d13feb7aaec5708545e00 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 6 Nov 2015 17:45:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9F=90=E4=BA=9B=E8=BF=9F=E4=BA=A4?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E5=93=81=E4=B8=8D=E6=98=BE=E7=A4=BA=E2=80=9C?= =?UTF-8?q?[=E8=BF=9F=E4=BA=A4]=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_evaluation_un_work.html.erb | 2 +- app/views/student_work/_evaluation_work.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 6996ed6a6..02e73aaab 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -28,7 +28,7 @@
  • <% if student_work.created_at && @homework.end_time%> <%= 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") %> [迟交] <% end %> <% end %> diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 4a6a4eb68..78114d62b 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -48,7 +48,7 @@
  • <%= 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") %> [迟交] <% end %>
  • From 48547f3e113f844cf610d407cf936b089a8cdb8c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 6 Nov 2015 17:47:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1/=E6=B7=BB=E5=8A=A0members=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=202=E3=80=81=E8=BF=87=E6=BB=A4=E6=8E=89=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=BA=93identifier=E9=87=8D=E5=A4=8D=E5=80=BC?= =?UTF-8?q?=E7=9A=84=E7=89=88=E6=9C=AC=E5=BA=93=203=E3=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0puts=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/gitlab_to_git.rake | 11 +++++++++++ lib/tasks/sync_sigle_rep.rake | 26 +++++++++++++++++--------- lib/trustie/gitlab/sync.rb | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/lib/tasks/gitlab_to_git.rake b/lib/tasks/gitlab_to_git.rake index 8b7f7279e..c7b97e00d 100644 --- a/lib/tasks/gitlab_to_git.rake +++ b/lib/tasks/gitlab_to_git.rake @@ -8,4 +8,15 @@ namespace :rep_fault do rep.save 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 \ No newline at end of file diff --git a/lib/tasks/sync_sigle_rep.rake b/lib/tasks/sync_sigle_rep.rake index b99221c83..591dcce84 100644 --- a/lib/tasks/sync_sigle_rep.rake +++ b/lib/tasks/sync_sigle_rep.rake @@ -3,19 +3,27 @@ namespace :sync_rep do desc "sync some projects which just have sigle repository" task :sigle => :environment do - projects = Project.all + projects = Project.where("user_id !=?",12) projects.each do |project| # 针对类型为Git并且只有一个版本库的项目 if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git" rep = project.repositories.first - 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 + count = Repository.find_by_sql("SELECT * FROM `repositories` where identifier = '#{rep.identifier}'").count + puts count + unless count > 1 + rep.identifier + puts "################################" + puts project.id + puts rep.id + 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 diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index 8c84984ee..a303b22fb 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -69,6 +69,11 @@ module Trustie # import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git # can use password + puts "@@@@@@@@@@@@@@@@@@@@@@@" + puts path + puts project.description + puts gid + puts import_url gproject = self.g.create_project(path, path: path, description: project.description, @@ -81,6 +86,7 @@ module Trustie user_id: gid, import_url: import_url ) + puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" project.gpid = gproject.id project.save! puts "Successfully created #{project.name}" @@ -100,6 +106,20 @@ module Trustie 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 end end From 4e62dd121978fea218a862eb75f890aab2314ed9 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 7 Nov 2015 19:58:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/new_user_commit_homework.html.erb | 2 +- app/views/users/user_commit_homework.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index c3a736058..0e2648509 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -112,7 +112,7 @@
    <% if test.status.to_i == -2 %> -
    <%= test.results.first %>
    +
    <%= test.results.first %>
    <% else %>
      diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb index a7416cf40..6f14ce05d 100644 --- a/app/views/users/user_commit_homework.html.erb +++ b/app/views/users/user_commit_homework.html.erb @@ -86,7 +86,7 @@
    <% if test.status.to_i == -2 %> -
    <%= test.results.first %>
    +
    <%= test.results.first %>
    <% else %>