From 958631ce36158d91c1c40ce8baad4a93010cf742 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 Aug 2024 14:54:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E7=A6=85=E9=81=93?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/import_issues_from_chandao.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/import_issues_from_chandao.rake b/lib/tasks/import_issues_from_chandao.rake index fd4c74ca1..245e6df14 100644 --- a/lib/tasks/import_issues_from_chandao.rake +++ b/lib/tasks/import_issues_from_chandao.rake @@ -9,7 +9,7 @@ namespace :import_from_chandao do CSV.foreach("#{Rails.root}/#{args.name}", headers: true) do | row | randd_field_hash = row.to_hash issue = Issue.new(issue_classify: "issue") - author = User.like(randd_field_hash['由谁创建']).take || User.where(admin: first).first + author = User.like(randd_field_hash['由谁创建']).take || User.where(admin: true).first issue.author_id = author&.id assigner = randd_field_hash['指派给'].present? ? User.like(randd_field_hash['指派给']).take : nil if assigner.present? @@ -47,7 +47,7 @@ namespace :import_from_chandao do CSV.foreach("#{Rails.root}/#{name}", headers: true) do | row | randd_field_hash = row.to_hash issue = Issue.new(issue_classify: "issue") - author = User.like(randd_field_hash['由谁创建']).take + author = User.like(randd_field_hash['由谁创建']).take || User.where(admin: true).first issue.author_id = author&.id assigner = randd_field_hash['指派给'].present? ? User.like(randd_field_hash['指派给']).take : nil if assigner.present? @@ -82,7 +82,7 @@ namespace :import_from_chandao do CSV.foreach("#{Rails.root}/#{name}", headers: true) do | row | randd_field_hash = row.to_hash issue = Issue.new(issue_classify: "issue") - author = User.like(randd_field_hash['由谁创建']).take + author = User.like(randd_field_hash['由谁创建']).take || User.where(admin: true).first issue.author_id = author&.id assigner = randd_field_hash['指派给'].present? ? User.like(randd_field_hash['指派给']).take : nil if assigner.present?