|
|
|
@@ -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? |
|
|
|
|