Commit c67f1814 by Tấn Trần Thanh

case user not input a link

parent e074c4a1
Pipeline #1600 failed with stages
in 0 seconds
module WorkflowReport module WorkflowReport
TABLE_HEADER = ['root_id', 'project', 'subject', 'target_version', 'created_on ', 'closed_on ', 'due_date ', 'status ', 'Estimated_hours (*final version)', 'Actual time', 'Diff', 'Estimated_hours (*Initial version)', TABLE_HEADER = ['root_id', 'project', 'subject', 'target_version', 'created_on ', 'closed_on ', 'due_date ', 'status ', 'Estimated_hours (*final version)', 'Actual time', 'Diff', 'Estimated_hours (*Initial version)',
'Number of estimation changes', 'Note of estimation changes', '1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', 'Others', '1. Requirement', '2. Design', '3. Coding', 'Number of estimation changes', 'Note of estimation changes', '1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', 'Others', '1. Requirement', '2. Design', '3. Coding',
'4. Testing', '5. Bug fixing', '6. Release', 'Others', 'testcases', 'vn STG bug', 'Jp STG bug', 'Production', 'Issue', 'Issue comment', 'PR comment', 'Review comment', 'Commits', 'File changed', 'Addtion', 'Deletetion'] '4. Testing', '5. Bug fixing', '6. Release', 'Others', 'testcases', 'vn STG bug', 'Jp STG bug', 'Production', 'Issue', 'Issue comment', 'PR comment', 'Review comment', 'Commits', 'File changed', 'Addtion', 'Deletetion'].freeze
EST_DETAIL_FIRST_COL = 14 EST_DETAIL_FIRST_COL = 14
ACTUAL_TIME_DETAIL_FIRST_COL = 21 ACTUAL_TIME_DETAIL_FIRST_COL = 21
PR_CMT_COL = 34 PR_CMT_COL = 34
PROCESS = ['1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', ''] PROCESS = ['1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', ''].freeze
BUGS = { testcases: 28, bugs: 29, stg_bugs: 30, prod_bugs: 31 } BUGS = { testcases: 28, bugs: 29, stg_bugs: 30, prod_bugs: 31 }.freeze
class << self class << self
def build_report(year, month, project_ids) def build_report(year, month, project_ids)
...@@ -93,7 +93,10 @@ module WorkflowReport ...@@ -93,7 +93,10 @@ module WorkflowReport
result[column].push(sum_hours_record[status].to_i >= 0 ? sum_hours_record[status] : '') result[column].push(sum_hours_record[status].to_i >= 0 ? sum_hours_record[status] : '')
end end
end end
if jp_request.present? if jp_request.strip.blank?
result[32] << ''
result[33] << ''
else
jp_request = jp_request.strip jp_request = jp_request.strip
result[32] << jp_request result[32] << jp_request
begin begin
...@@ -101,14 +104,13 @@ module WorkflowReport ...@@ -101,14 +104,13 @@ module WorkflowReport
if jp_request_arr.length >= 4 && jp_request_arr[3].to_i.positive? if jp_request_arr.length >= 4 && jp_request_arr[3].to_i.positive?
issue_detail = github.issues.find user: jp_request_arr[0], repo: jp_request_arr[1], number: jp_request_arr[3] issue_detail = github.issues.find user: jp_request_arr[0], repo: jp_request_arr[1], number: jp_request_arr[3]
result[33].push(issue_detail.success? ? issue_detail.comments : '') result[33].push(issue_detail.success? ? issue_detail.comments : '')
else
result[33].push('') if result[33][result[0].length - 1].nil?
end end
rescue => e rescue StandardError => e
error_links << "##{root_id} Error occurred during the build with the ISSUE link:\r\n - #{jp_request} \r\n - #{e.message.gsub(/(?<=access_token=).*/, '123')}" error_links << "##{root_id} Error occurred during the build with the ISSUE link:\r\n - #{jp_request} \r\n - #{e.message.gsub(/(?<=access_token=).*/, '123')}"
result[33].push('') result[33].push('') if result[33][result[0].length - 1].nil?
end end
else
result[32] << ''
result[33] << ''
end end
# pr detail # pr detail
pr = { pr_comments: 0, pr_review_comments: 0, pr_commits: 0, pr_changed_files: 0, pr_additions: 0, pr_deletions: 0 } pr = { pr_comments: 0, pr_review_comments: 0, pr_commits: 0, pr_changed_files: 0, pr_additions: 0, pr_deletions: 0 }
...@@ -129,7 +131,7 @@ module WorkflowReport ...@@ -129,7 +131,7 @@ module WorkflowReport
pr[:pr_deletions] += pr_detail.deletions pr[:pr_deletions] += pr_detail.deletions
pr[:pr_changed_files] += pr_detail.changed_files pr[:pr_changed_files] += pr_detail.changed_files
end end
rescue => e rescue StandardError => e
error_links << "##{root_id} Error occurred during the build with the PR link:\r\n - #{link} \r\n - #{e.message.gsub(/(?<=access_token=).*/, '123')}" error_links << "##{root_id} Error occurred during the build with the PR link:\r\n - #{link} \r\n - #{e.message.gsub(/(?<=access_token=).*/, '123')}"
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment