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

fix(pdf-export): wrong batch index running (#12707)

Andrej Sandorff4d5eccdace9
diff --git a/app/models/work_package/pdf_export/work_package_list_to_pdf.rb b/app/models/work_package/pdf_export/work_package_list_to_pdf.rb
index 3db88ce8352..166baa31960 100644
--- a/app/models/work_package/pdf_export/work_package_list_to_pdf.rb
+++ b/app/models/work_package/pdf_export/work_package_list_to_pdf.rb
@@ -113,7 +113,7 @@ class WorkPackage::PDFExport::WorkPackageListToPdf < WorkPackage::Exports::Query
def render_batched(work_packages, filename)
@batches_count = work_packages.length.fdiv(@work_packages_per_batch).ceil
batch_files = []
- (1..@batches_count).each do |batch_index|
+ (0..(@batches_count - 1)).each do |batch_index|
batch_work_packages = work_packages.slice(batch_index * @work_packages_per_batch, @work_packages_per_batch)
unless batch_work_packages.nil?
batch_files.push render_pdf(batch_work_packages, "pdf_batch_#{batch_index}.pdf")