commit提取贡献者创建时间
This commit is contained in:
parent
48a60a4abc
commit
d890e01aed
|
@ -1,5 +1,5 @@
|
||||||
namespace :batch_add_contributors do
|
namespace :batch_add_contributors do
|
||||||
desc "commit_log_to_db"
|
desc "batch_add_contributors"
|
||||||
task done: :environment do
|
task done: :environment do
|
||||||
puts "project_id=================#{ENV['project_id']}"
|
puts "project_id=================#{ENV['project_id']}"
|
||||||
return if ENV['project_id'].blank?
|
return if ENV['project_id'].blank?
|
||||||
|
@ -42,7 +42,7 @@ namespace :batch_add_contributors do
|
||||||
sql_connection = ActiveRecord::Base.connection
|
sql_connection = ActiveRecord::Base.connection
|
||||||
sql_connection.begin_db_transaction
|
sql_connection.begin_db_transaction
|
||||||
if Issue.find_by_sql("select id from commit_contributors where name='#{commiter['email']}'").present?
|
if Issue.find_by_sql("select id from commit_contributors where name='#{commiter['email']}'").present?
|
||||||
sql = "update commit_contributors set created_at ='#{}' where name='#{commiter['email']}'"
|
sql = "update commit_contributors set created_at ='#{commit_date_str}' where name='#{commiter['email']}'"
|
||||||
else
|
else
|
||||||
sql = "INSERT INTO commit_contributors (`created_at`, `count`, `name`) VALUES ('#{commit_date_str}',1,'#{commiter['email']}')"
|
sql = "INSERT INTO commit_contributors (`created_at`, `count`, `name`) VALUES ('#{commit_date_str}',1,'#{commiter['email']}')"
|
||||||
end
|
end
|
||||||
|
@ -92,7 +92,7 @@ namespace :batch_add_contributors do
|
||||||
sql_connection = ActiveRecord::Base.connection
|
sql_connection = ActiveRecord::Base.connection
|
||||||
sql_connection.begin_db_transaction
|
sql_connection.begin_db_transaction
|
||||||
if Issue.find_by_sql("select id from commit_contributors where name='#{commiter['email']}'").present?
|
if Issue.find_by_sql("select id from commit_contributors where name='#{commiter['email']}'").present?
|
||||||
sql = "update commit_contributors set created_at ='#{}' where name='#{commiter['email']}'"
|
sql = "update commit_contributors set created_at ='#{commit_date_str}' where name='#{commiter['email']}'"
|
||||||
else
|
else
|
||||||
sql = "INSERT INTO commit_contributors (`created_at`, `count`, `name`) VALUES ('#{commit_date_str}',1,'#{commiter['email']}')"
|
sql = "INSERT INTO commit_contributors (`created_at`, `count`, `name`) VALUES ('#{commit_date_str}',1,'#{commiter['email']}')"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue