Skip to content

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

obey rubocop

as-op4fd2a2d0d9d9
diff --git a/frontend/src/stimulus/controllers/dynamic/costs/export.controller.ts b/frontend/src/stimulus/controllers/dynamic/costs/export.controller.ts
index 183aa9ffc91..ba839789d48 100644
--- a/frontend/src/stimulus/controllers/dynamic/costs/export.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/costs/export.controller.ts
@@ -14,7 +14,6 @@ export default class ExportController extends Controller<HTMLLinkElement> {
}
async showJobModal(job_id:string) {
- console.log(this.jobModalUrl(job_id));
const response = await fetch(this.jobModalUrl(job_id), {
method: 'GET',
headers: { Accept: 'text/vnd.turbo-stream.html' },
@@ -43,7 +42,7 @@ export default class ExportController extends Controller<HTMLLinkElement> {
}
get href() {
- return (this.element as HTMLLinkElement).href;
+ return this.element.href;
}
download(evt:CustomEvent) {
diff --git a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
index 907228cbd28..127c32571b1 100644
--- a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
+++ b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb
@@ -34,6 +34,7 @@ class CostQuery::PDF::TimesheetGenerator
self.pdf = get_pdf
@page_count = 0
configure_page_size!(:portrait)
+ pdf.title = heading
end
def generate!
@@ -46,19 +47,31 @@ class CostQuery::PDF::TimesheetGenerator
def render_doc
write_cover_page! if with_cover?
+ write_heading!
+ write_hr!
+ write_entries!
+ end
+ def write_heading!
pdf.formatted_text([{ text: heading }])
- write_hr
- query
- .each_direct_result
- .map(&:itself)
- .filter { |r| r.fields["type"] == "TimeEntry" }
+ end
+
+ def write_entries!
+ all_entries
.group_by { |r| r.fields["user_id"] }
.each do |user_id, result|
write_table(user_id, result)
end
end
+ def all_entries
+ query
+ .each_direct_result
+ .map(&:itself)
+ .filter { |r| r.fields["type"] == "TimeEntry" }
+ end
+
+ # rubocop:disable Metrics/AbcSize
def build_table_rows(entries)
rows = []
entries
@@ -82,6 +95,7 @@ class CostQuery::PDF::TimesheetGenerator
end
rows
end
+ # rubocop:enable Metrics/AbcSize
def format_duration(hours)
return "" if hours < 0
@@ -105,12 +119,16 @@ class CostQuery::PDF::TimesheetGenerator
query.each_direct_result.map(&:itself)
end
- def write_hr
+ # rubocop:disable Metrics/AbcSize
+ def write_hr!
hr_style = styles.cover_header_border
- pdf.stroke_color = hr_style[:color]
- pdf.line_width = hr_style[:height]
- pdf.stroke_horizontal_line pdf.bounds.left, pdf.bounds.right, at: pdf.cursor
+ pdf.stroke do
+ pdf.line_width = hr_style[:color]
+ pdf.stroke_color hr_style[:height]
+ pdf.stroke_horizontal_line pdf.bounds.left, pdf.bounds.right, at: pdf.cursor
+ end
end
+ # rubocop:enable Metrics/AbcSize
def with_cover?
true