OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix column widths in sum table
as-op6b7197e72d97
diff --git a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rbindex f908459e3a3..9dd9fa8045d 100644--- a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb+++ b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb@@ -46,6 +46,7 @@ class CostQuery::PDF::TimesheetGeneratorCOMMENT_FONT_COLOR = "636C76".freezeH2_FONT_SIZE = 20H2_MARGIN_BOTTOM = 10+ SUM_TABLE_FIRST_COLUMN_WIDTH = 68COLUMN_DATE_WIDTH = 66COLUMN_ACTIVITY_WIDTH = 100@@ -151,13 +152,13 @@ class CostQuery::PDF::TimesheetGeneratordef all_entries@all_entries ||= begin- ids = query- .each_direct_result- .filter { |r| r.fields["type"] == "TimeEntry" }- .flat_map { |r| r.fields["id"] }+ ids = query+ .each_direct_result+ .filter { |r| r.fields["type"] == "TimeEntry" }+ .flat_map { |r| r.fields["id"] }- TimeEntry.where(id: ids).includes(%i[user activity work_package project])- end+ TimeEntry.where(id: ids).includes(%i[user activity work_package project])+ endenddef build_table_rows(entries)@@ -224,11 +225,11 @@ class CostQuery::PDF::TimesheetGeneratordef build_table_row_comment(entry)[{- content: entry.comments,- text_color: COMMENT_FONT_COLOR,- font_style: :italic,- colspan: table_columns_widths.size- }]+ content: entry.comments,+ text_color: COMMENT_FONT_COLOR,+ font_style: :italic,+ colspan: table_columns_widths.size+ }]enddef table_header_columns@@ -414,6 +415,7 @@ class CostQuery::PDF::TimesheetGeneratorusers.each_slice(6) do |users_chunk|write_sum_table!(users_chunk, start_date, end_date)+ pdf.move_down(28)endstart_new_page_if_needed@@ -443,7 +445,7 @@ class CostQuery::PDF::TimesheetGeneratorendreturn nil unless row.any? { |column| !column.empty? }- [format_date(date)] + row+ [content:format_date(date)] + rowenddef calc_sum_for_user_on_day(user, date)@@ -468,7 +470,7 @@ class CostQuery::PDF::TimesheetGeneratorusers.map do |user|{content: make_link_anchor("user_#{user.id}", user.name),- inline_format: true, align: :right, font_style: :bold+ inline_format: true, font_style: :bold}endrows.unshift(header_row)@@ -477,6 +479,7 @@ class CostQuery::PDF::TimesheetGeneratorrows,header: true,width: pdf.bounds.width,+ column_widths: sum_table_column_widths(users),cell_style: {size: TABLE_CELL_FONT_SIZE,border_color: TABLE_CELL_BORDER_COLOR,@@ -487,6 +490,12 @@ class CostQuery::PDF::TimesheetGenerator).drawend+ def sum_table_column_widths(users)+ [SUM_TABLE_FIRST_COLUMN_WIDTH].concat(+ [(pdf.bounds.width - SUM_TABLE_FIRST_COLUMN_WIDTH) / users.length] * users.length+ )+ end+def adjust_overview_border_sum_row(table)row = table.rows(-1)row.columns(0).style { |c| c.borders = c.borders - [:right] }