Commit 4164867a by Tấn Trần Thanh

fix comment

parent 9059d20b
Pipeline #1604 failed with stages
in 0 seconds
class WorkflowReportIssue < Issue
BUG_TRACKER_ID = 1
CLOSED_STATUS_PROJECT = 9
belongs_to :workflow_report_version, class_name: 'Version', foreign_key: 'fixed_version_id'
has_many :workflow_report_custom_values, class_name: 'WorkflowReportCustomValue', foreign_key: 'customized_id'
scope :raw_tasks_records, -> (year, month, project_ids) {
includes(:project, :workflow_report_version, :workflow_report_custom_values, :time_entries, :status, project: :enabled_modules)
.where.not(projects: { status: 9 }, issues: { tracker_id: 1 })
.where.not(projects: { status: CLOSED_STATUS_PROJECT }, issues: { tracker_id: BUG_TRACKER_ID })
.where(projects: { id: project_ids }, enabled_modules: { name: 'time_tracking' })
.where(['((time_entries.spent_on IS NOT NULL AND time_entries.tyear = ? AND time_entries.tmonth = ?) OR (issues.closed_on BETWEEN ? AND ?))',
year, month, DateTime.new(year, month).beginning_of_day, DateTime.new(year, month, -1).end_of_day])
......
......@@ -8,6 +8,8 @@ module WorkflowReport
PR_FIELD_ID = 18
JP_REQUEST_FIELD_ID = 16
BUG_COLS = 28
USER_STORY_TRACKER_ID = 12
COL_REQUIREMENT_TO_RELEASE = 6
PROCESS = ['1. Requirement', '2. Design', '3. Coding', '4. Testing', '5. Bug fixing', '6. Release', ''].freeze
BUGS = { testcases: 22, bugs: 23, stg_bugs: 27, prod_bugs: 28 }.freeze
......@@ -61,7 +63,7 @@ module WorkflowReport
pull_request = ''
jp_request = ''
issues.each do |issue|
if issue.tracker_id == 12
if issue.tracker_id == USER_STORY_TRACKER_ID
pull_request = issue.custom_values.find_by(custom_field_id: PR_FIELD_ID)&.value
jp_request = issue.custom_values.find_by(custom_field_id: JP_REQUEST_FIELD_ID)&.value
end
......@@ -78,12 +80,12 @@ module WorkflowReport
end
end
else
6.times do |index|
COL_REQUIREMENT_TO_RELEASE.times do |index|
build_est_to_actual_time!(result, EST_DETAIL_FIRST_COL, 0, index)
build_est_to_actual_time!(result, ACTUAL_TIME_DETAIL_FIRST_COL, 0, index)
end
build_est_to_actual_time!(result, EST_DETAIL_FIRST_COL, issue.estimated_hours.to_f, 6)
build_est_to_actual_time!(result, ACTUAL_TIME_DETAIL_FIRST_COL, issue.spent_hours.to_f, 6)
build_est_to_actual_time!(result, EST_DETAIL_FIRST_COL, issue.estimated_hours.to_f, COL_REQUIREMENT_TO_RELEASE)
build_est_to_actual_time!(result, ACTUAL_TIME_DETAIL_FIRST_COL, issue.spent_hours.to_f, COL_REQUIREMENT_TO_RELEASE)
end
end
if sum_estimated_hours.zero?
......
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