提交日志中创建时间按commit date来

This commit is contained in:
xxq250 2024-04-24 11:16:59 +08:00
parent 6f0993396d
commit 031ad5fb08
1 changed files with 2 additions and 1 deletions

View File

@ -19,9 +19,10 @@ class CommitLogsController < ApplicationController
params[:commits].each do |commit|
commit_id = commit[:id]
message = commit[:message]
commit_date = Time.parse(commit[:timestamp]) || Time.now
commit_log = CommitLog.create(user: user, project: project, repository_id: repository_id,
name: repository_name, full_name: repository_full_name,
ref: ref, commit_id: commit_id, message: message)
ref: ref, commit_id: commit_id, message: message, created_at: commit_date, updated_at: commit_date)
commit_log.project_trends.create(user_id: user.id, project_id: project&.id, action_type: "create") if user.id !=2
# 统计数据新增
CacheAsyncSetJob.perform_later("project_common_service", {commits: 1}, project.id)