修复:更新无法设置空值
This commit is contained in:
parent
4657618753
commit
02526878fe
|
@ -5,6 +5,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
|||
before_action :check_issue_operate_permission, only: [:update, :destroy]
|
||||
|
||||
def index
|
||||
IssueTag.init_data(@project.id) if @project.issue_tags.size < 10
|
||||
@object_results = Api::V1::Issues::ListService.call(@project, query_params, current_user)
|
||||
@opened_issues_count = @object_results.opened.size
|
||||
@closed_issues_count = @object_results.closed.size
|
||||
|
|
|
@ -36,9 +36,12 @@ class IssueStatus < ApplicationRecord
|
|||
"6" => "拒绝"
|
||||
}
|
||||
IssueStatus.order(id: :asc).each do |stat|
|
||||
next if map[stat.id] == stat.name
|
||||
Issue.where(status_id: stat.id).each{|i| i.update_column(:status_id, 1)}
|
||||
stat.destroy!
|
||||
if map[stat.id] == stat.name
|
||||
IssueStatus.find_or_create_by(id: stat.id, name: stat.name)
|
||||
else
|
||||
Issue.where(status_id: stat.id).each{|i| i.update_column(:status_id, 1)}
|
||||
stat.destroy!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,12 +84,12 @@ class Api::V1::Issues::UpdateService < ApplicationService
|
|||
def issue_load_attributes
|
||||
@updated_issue.status_id = status_id if status_id.present?
|
||||
@updated_issue.priority_id = priority_id if priority_id.present?
|
||||
@updated_issue.fixed_version_id = milestone_id if milestone_id.present?
|
||||
@updated_issue.branch_name = branch_name if branch_name.present?
|
||||
@updated_issue.start_date = start_date if start_date.present?
|
||||
@updated_issue.due_date = due_date if due_date.present?
|
||||
@updated_issue.fixed_version_id = milestone_id unless milestone_id.nil?
|
||||
@updated_issue.branch_name = branch_name unless branch_name.nil?
|
||||
@updated_issue.start_date = start_date unless start_date.nil?
|
||||
@updated_issue.due_date = due_date unless due_date.nil?
|
||||
@updated_issue.subject = subject if subject.present?
|
||||
@updated_issue.description = description if description.present?
|
||||
@updated_issue.description = description unless description.nil?
|
||||
end
|
||||
|
||||
def build_assigner_participants
|
||||
|
|
|
@ -14,6 +14,7 @@ class Projects::CreateService < ApplicationService
|
|||
ActiveRecord::Base.transaction do
|
||||
if @project.save!
|
||||
Project.update_common_projects_count!
|
||||
IssueTag.init_data(@project.id)
|
||||
ProjectUnit.init_types(@project.id)
|
||||
Repositories::CreateService.new(user, @project, repository_params).call
|
||||
upgrade_project_category_private_projects_count
|
||||
|
|
Loading…
Reference in New Issue