Browse Source

rake commit_log_to_db 用户不存在

pull/342/head
xxq250 3 years ago
parent
commit
f370e1906e
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      lib/tasks/commit_log_to_db.rake

+ 4
- 4
lib/tasks/commit_log_to_db.rake View File

@@ -25,9 +25,9 @@ namespace :commit_log_to_db do
commit_author = "#{commiter['name']} <#{commiter['email']}>" commit_author = "#{commiter['name']} <#{commiter['email']}>"
commit_sha = commit['sha'] commit_sha = commit['sha']
ref = "master" ref = "master"
commit_message = commit['commit']['message'].to_s.gsub("/n","")
commit_message = commit['commit']['message'].to_s.gsub("\"","")
user = User.find_by(mail: commiter['email']) user = User.find_by(mail: commiter['email'])
user_id = user&.id || 1
user_id = user&.id || project.user_id
commit_date = Time.parse(commit['commit']['author']['date']) commit_date = Time.parse(commit['commit']['author']['date'])
commit_date_str = commit_date.strftime("%a %b %d %H:%M:%S") commit_date_str = commit_date.strftime("%a %b %d %H:%M:%S")


@@ -60,9 +60,9 @@ namespace :commit_log_to_db do
commit_author = "#{commiter['name']} <#{commiter['email']}>" commit_author = "#{commiter['name']} <#{commiter['email']}>"
commit_sha = commit['sha'] commit_sha = commit['sha']
ref = "master" ref = "master"
commit_message = commit['commit']['message'].to_s.gsub("/n","")
commit_message = commit['commit']['message'].to_s.gsub("/n","").gsub("\"","")
user = User.find_by(mail: commiter['email']) user = User.find_by(mail: commiter['email'])
user_id = user&.id || 1
user_id = user&.id || project.user_id
commit_date = Time.parse(commit['commit']['author']['date']) commit_date = Time.parse(commit['commit']['author']['date'])
commit_date_str = commit_date.strftime("%Y-%m-%d %H:%M:%S") commit_date_str = commit_date.strftime("%Y-%m-%d %H:%M:%S")




Loading…
Cancel
Save