change project_score

This commit is contained in:
sylor_huang@126.com 2020-07-10 15:44:52 +08:00
parent e9f93ddc20
commit 4e32d7b0a6
1 changed files with 5 additions and 5 deletions

View File

@ -3,6 +3,7 @@ class SyncForgeController < ApplicationController
def create
ActiveRecord::Base.transaction do
params.permit!
sync_params = params[:sync_params]
#以前已同步的项目,那么肯定存在仓库
if Project.exists?(id: sync_params[:id], identifier: sync_params[:identifier])
@ -24,11 +25,10 @@ class SyncForgeController < ApplicationController
Rails.logger.info("=================new_repository_id:#{project&.repository&.id}========")
if project.present?
if sync_params[:project_score].present?
score_params = sync_params[:project_score]
new_project_score = ProjectScore.create(:project_id => project.id)
Rails.logger.info("=================new_project_score:#{new_project_score}========")
new_project_score.update_attributes(score_params)
Rails.logger.info("=================new_project_score:#{new_project_score}========")
sync_params.permit!
score_params = sync_params[:project_score].merge(project_id: project.id)
new_project_score = ProjectScore.create(score_params)
Rails.logger.info("=================new_project_score:#{new_project_score.try(:id)}========")
end
SyncRepositoryJob.perform_later(project.repository, sync_params[:repository]) if sync_params[:repository].present?
check_new_project(project, sync_params)