修复:绑定分支变量名更正以及日志排序

This commit is contained in:
yystopf 2024-04-25 17:00:01 +08:00
parent e556e53f54
commit d5f841441b
1 changed files with 4 additions and 3 deletions

View File

@ -82,10 +82,10 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
params[:sync_repository_ids].split(",").each do |id|
repo = SyncRepository.find_by_id id
branch = Reposync::CreateSyncBranchService.call(repo.repo_name, params[:gitlink_branch_name], params[:external_branch_name])
Reposync::CreateSyncBranchService.call(repo.repo_name, params[:gitlink_branch_name], params[:external_branch_name])
return render_error(branch[2]) if branch[0].to_i !=0
SyncRepositoryBranch.create!(sync_repository_id: id, gitlink_branch_name: params[:gitlink_branch_name], external_branch_name: params[:external_branch_name], reposync_branch_id: branch[1]['id'])
TouchSyncJob.perform_later(branch) if params[:first_sync_direction].to_i == repo.sync_direction
sync_branch = SyncRepositoryBranch.create!(sync_repository_id: id, gitlink_branch_name: params[:gitlink_branch_name], external_branch_name: params[:external_branch_name], reposync_branch_id: branch[1]['id'])
TouchSyncJob.perform_later(sync_branch) if params[:first_sync_direction].to_i == repo.sync_direction
end
render_ok
rescue Exception => e
@ -109,6 +109,7 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
_, logs, _ = Reposync::GetLogsService.call(repo&.repo_name, branch_id)
@reposync_branch_logs += logs
end
@reposync_branch_logs = @reposync_branch_logs.sort_by{|log|log["update_at"]}
end
private