From f1a79d926c9457c7bb5d833f494f7b2e4d2c8094 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 7 Aug 2024 11:27:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9Anil=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/issues_controller.rb | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index a85c5b310..e56ef5e53 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -162,19 +162,23 @@ class Api::Pm::IssuesController < Api::Pm::BaseController issue.changer = changer issue.updated_on = row[5] issue.status_id = row[6].to_i - row[7].split(',').each do |a| - u = User.find_by(login: a) - next unless u.present? - issue.assigners << u + if row[7].present? + row[7].split(',').each do |a| + u = User.find_by(login: a) + next unless u.present? + issue.assigners << u + end end issue.priority_id = row[8] - row[9].split(',').each_slice(2).to_a.each do |t| - tag = IssueTag.find_by(project_id: 0, organization_id: params[:organization_id], name: t[0]) - if tag.present? - issue.issue_tags << tag - else - tag = IssueTag.create(project_id: 0,organization_id: params[:organization_id], name: t[0], color: t[1]) - issue.issue_tags << tag + if row[9].present? + row[9].split(',').each_slice(2).to_a.each do |t| + tag = IssueTag.find_by(project_id: 0, organization_id: params[:organization_id], name: t[0]) + if tag.present? + issue.issue_tags << tag + else + tag = IssueTag.create(project_id: 0,organization_id: params[:organization_id], name: t[0], color: t[1]) + issue.issue_tags << tag + end end end issue.start_date = row[10]