This commit is contained in:
yystopf 2024-09-03 10:40:27 +08:00
parent cd71532dd7
commit 9ec3f4655e
1 changed files with 8 additions and 10 deletions

View File

@ -24,8 +24,8 @@ namespace :import_from_chandao do
end end
desc "bug数据" desc "bug数据"
# 执行示例 bundle exec rake "import_from_chandao:bugs[企业内部工时管理系统.csv, 3]" # 执行示例 bundle exec rake "import_from_chandao:bugs[企业内部工时管理系统.csv, 3, ceshi_org]"
# RAILS_ENV=production bundle exec rake "import_from_chandao:bugs[企业内部工时管理系统.csv, 3]" # RAILS_ENV=production bundle exec rake "import_from_chandao:bugs[企业内部工时管理系统.csv, 3, ceshi_org]"
task :bugs, [:name, :pm_project_id, :org_login] => :environment do |t, args| task :bugs, [:name, :pm_project_id, :org_login] => :environment do |t, args|
org = Organization.find_by(login: args.org_login) org = Organization.find_by(login: args.org_login)
if org.present? if org.present?
@ -59,8 +59,7 @@ namespace :import_from_chandao do
issue.project_id = 0 issue.project_id = 0
issue.pm_project_id = args.pm_project_id issue.pm_project_id = args.pm_project_id
issue.pm_issue_type = 3 issue.pm_issue_type = 3
sprint_name = randd_field_hash['所属迭代'].split('(#')[0] sprint = get_sprint_data(randd_field_hash['所属迭代'].split('(#')[0], args.pm_project_id, org) rescue nil
sprint = get_sprint_data(sprint_name, args.pm_project_id, org)
issue.pm_sprint_id = sprint['id'] if sprint.present? issue.pm_sprint_id = sprint['id'] if sprint.present?
issue.save! issue.save!
requirement_issue = Issue.find_by(project_issues_index: randd_field_hash['相关需求'].split('(#')[1].split(')')[0], pm_project_id: args.pm_project_id, pm_issue_type: 1) rescue nil requirement_issue = Issue.find_by(project_issues_index: randd_field_hash['相关需求'].split('(#')[1].split(')')[0], pm_project_id: args.pm_project_id, pm_issue_type: 1) rescue nil
@ -77,8 +76,8 @@ namespace :import_from_chandao do
end end
end end
# 执行示例 bundle exec rake "import_from_chandao:tasks[复杂智能软件项目-所有任务.csv, 365]" # 执行示例 bundle exec rake "import_from_chandao:tasks[复杂智能软件项目-所有任务.csv, 365, ceshi_org]"
# RAILS_ENV=production bundle exec rake "import_from_chandao:tasks[复杂智能软件项目-所有任务.csv, 365]" # RAILS_ENV=production bundle exec rake "import_from_chandao:tasks[复杂智能软件项目-所有任务.csv, 365, ceshi_org]"
task :tasks, [:name, :pm_project_id, :org_login] => :environment do |t, args| task :tasks, [:name, :pm_project_id, :org_login] => :environment do |t, args|
org = Organization.find_by(login: args.org_login) org = Organization.find_by(login: args.org_login)
if org.present? if org.present?
@ -117,8 +116,7 @@ namespace :import_from_chandao do
issue.project_id = 0 issue.project_id = 0
issue.pm_project_id = pm_project_id issue.pm_project_id = pm_project_id
issue.pm_issue_type = 2 issue.pm_issue_type = 2
sprint_name = randd_field_hash['所属迭代'].split('(#')[0] sprint = get_sprint_data(randd_field_hash['所属迭代'].split('(#')[0], args.pm_project_id, org) rescue nil
sprint = get_sprint_data(sprint_name, args.pm_project_id, org)
issue.pm_sprint_id = sprint['id'] if sprint.present? issue.pm_sprint_id = sprint['id'] if sprint.present?
issue.save! issue.save!
requirement_issue = Issue.find_by(project_issues_index: randd_field_hash['相关需求'].split('(#')[1].split(')')[0], pm_project_id: pm_project_id, pm_issue_type: 1) rescue nil requirement_issue = Issue.find_by(project_issues_index: randd_field_hash['相关需求'].split('(#')[1].split(')')[0], pm_project_id: pm_project_id, pm_issue_type: 1) rescue nil
@ -131,8 +129,8 @@ namespace :import_from_chandao do
end end
end end
# 执行示例 bundle exec rake "import_from_chandao:requirements[企业网站第二期.csv, 3]" # 执行示例 bundle exec rake "import_from_chandao:requirements[企业网站第二期.csv, 3, ceshi_org]"
# RAILS_ENV=production bundle exec rake "import_from_chandao:requirements[企业网站第二期.csv, 3]" # RAILS_ENV=production bundle exec rake "import_from_chandao:requirements[企业网站第二期.csv, 3, ceshi_org]"
task :requirements, [:name, :pm_project_id, :org_login] => :environment do |t, args| task :requirements, [:name, :pm_project_id, :org_login] => :environment do |t, args|
org = Organization.find_by(login: args.org_login) org = Organization.find_by(login: args.org_login)
if org.present? if org.present?