Browse Source

更改:禅道导入数据脚本

pull/347/head
yystopf 1 year ago
parent
commit
958631ce36
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      lib/tasks/import_issues_from_chandao.rake

+ 3
- 3
lib/tasks/import_issues_from_chandao.rake View File

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


Loading…
Cancel
Save