commit提取贡献者创建时间
This commit is contained in:
parent
fe294e6fed
commit
d61622f31b
|
@ -41,6 +41,7 @@ namespace :batch_add_contributors do
|
|||
commit_date = Time.parse(commit['commit']['author']['date'])
|
||||
commit_date_str = commit_date.strftime("%Y-%m-%d %H:%M:%S")
|
||||
site = Site.find_by_sql("select id, created_at from commit_contributors where name='#{commiter['email']}'")
|
||||
sql =""
|
||||
if site.present?
|
||||
puts "commit_date====#{commit_date},created_at======#{site.first&.created_at}"
|
||||
if commit_date.to_i < site.first&.created_at.to_i
|
||||
|
@ -50,6 +51,7 @@ namespace :batch_add_contributors do
|
|||
sql = "INSERT INTO commit_contributors (`created_at`, `count`, `name`) VALUES ('#{commit_date_str}',1,'#{commiter['email']}')"
|
||||
end
|
||||
puts "sql====#{sql}"
|
||||
next if sql.blank?
|
||||
|
||||
sql_connection = ActiveRecord::Base.connection
|
||||
sql_connection.begin_db_transaction
|
||||
|
@ -95,7 +97,7 @@ namespace :batch_add_contributors do
|
|||
commit_date = Time.parse(commit['commit']['author']['date'])
|
||||
commit_date_str = commit_date.strftime("%Y-%m-%d %H:%M:%S")
|
||||
site = Site.find_by_sql("select id, created_at from commit_contributors where name='#{commiter['email']}'")
|
||||
|
||||
sql= ""
|
||||
if site.present?
|
||||
puts "commit_date====#{commit_date},created_at======#{site.first&.created_at}"
|
||||
if commit_date.to_i < site.first&.created_at.to_i
|
||||
|
@ -105,6 +107,7 @@ namespace :batch_add_contributors do
|
|||
sql = "INSERT INTO commit_contributors (`created_at`, `count`, `name`) VALUES ('#{commit_date_str}',1,'#{commiter['email']}')"
|
||||
end
|
||||
puts "sql====#{sql}"
|
||||
next if sql.blank?
|
||||
|
||||
sql_connection = ActiveRecord::Base.connection
|
||||
sql_connection.begin_db_transaction
|
||||
|
|
Loading…
Reference in New Issue