commit提取贡献者创建时间
This commit is contained in:
parent
7d51829e3c
commit
5bfa14e01a
|
@ -93,12 +93,16 @@ 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?
|
site = Site.find_by_sql("select id, created_at from commit_contributors where name='#{commiter['email']}'")
|
||||||
sql = "update commit_contributors set created_at ='#{commit_date_str}' where name='#{commiter['email']}'"
|
if site.present?
|
||||||
|
puts "commit_date====#{commit_date},created_at======#{site.created_at}"
|
||||||
|
if commit_date.to_i < site.created_at.to_i
|
||||||
|
sql = "update commit_contributors set created_at ='#{commit_date_str}' where name='#{commiter['email']}'"
|
||||||
|
end
|
||||||
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
|
||||||
puts "sql====#{sql}"
|
# puts "sql====#{sql}"
|
||||||
|
|
||||||
sql_connection.execute(sql)
|
sql_connection.execute(sql)
|
||||||
sql_connection.commit_db_transaction
|
sql_connection.commit_db_transaction
|
||||||
|
|
Loading…
Reference in New Issue