fixed reposyncer 分支组合已配置,不能重复

This commit is contained in:
“xxq250” 2022-08-04 17:20:24 +08:00
parent 72a4549fe9
commit 690ddcb4a7
1 changed files with 4 additions and 4 deletions

View File

@ -56,10 +56,10 @@ class ObRepositorySyncsController < ApplicationController
def create_jobs
tip_exception "必须配置一个分支" if params[:github_branch].blank? && params[:gitee_branch].blank? && params[:gitlink_branch].blank?
ob_jobs = ObRepositorySyncJob.where(ob_repository_sync_id: @ob_repository_sync.id)
ob_jobs.where(job_type: params[:job_type]) if params[:job_type].present?
ob_jobs.where(github_branch: params[:github_branch]) if params[:github_branch].present?
ob_jobs.where(gitee_branch: params[:gitee_branch]) if params[:gitee_branch].present?
ob_jobs.where(gitlink_branch: params[:gitlink_branch]) if params[:gitlink_branch].present?
ob_jobs = ob_jobs.where(job_type: params[:job_type]) if params[:job_type].present?
ob_jobs = ob_jobs.where(github_branch: params[:github_branch]) if params[:github_branch].present?
ob_jobs = ob_jobs.where(gitee_branch: params[:gitee_branch]) if params[:gitee_branch].present?
ob_jobs = ob_jobs.where(gitlink_branch: params[:gitlink_branch]) if params[:gitlink_branch].present?
tip_exception "该分支组合已配置,不能重复!" if ob_jobs.count > 0
service = ObRepositorySync::ApiService.new(@ob_repository_sync.name)
res = service.create_projects_jobs(params)