From 50bf879fbfc015e2d9c516a85de3b077c1309d4e Mon Sep 17 00:00:00 2001 From: viehlieb Date: Fri, 6 Jan 2023 16:55:40 +0100 Subject: [PATCH] resolve zeitwerk issues --- app/lib/articles_csv.rb | 2 +- app/lib/bank_transactions_csv.rb | 2 +- app/lib/financial_transactions_csv.rb | 2 +- app/lib/invoices_csv.rb | 2 +- app/lib/order_csv.rb | 2 +- app/lib/order_pdf.rb | 8 ++++---- app/lib/ordergroups_csv.rb | 2 +- app/lib/render_csv.rb | 2 +- app/lib/render_pdf.rb | 2 +- app/lib/users_csv.rb | 2 +- config/initializers/zeitwerk.rb | 2 ++ 11 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/lib/articles_csv.rb b/app/lib/articles_csv.rb index 9e6b4f40..55bc7fc5 100644 --- a/app/lib/articles_csv.rb +++ b/app/lib/articles_csv.rb @@ -1,4 +1,4 @@ -class ArticlesCsv < RenderCSV +class ArticlesCsv < RenderCsv include ApplicationHelper def header diff --git a/app/lib/bank_transactions_csv.rb b/app/lib/bank_transactions_csv.rb index 34c39403..4adbc192 100644 --- a/app/lib/bank_transactions_csv.rb +++ b/app/lib/bank_transactions_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class BankTransactionsCsv < RenderCSV +class BankTransactionsCsv < RenderCsv include ApplicationHelper def header diff --git a/app/lib/financial_transactions_csv.rb b/app/lib/financial_transactions_csv.rb index dc21d892..fc12d000 100644 --- a/app/lib/financial_transactions_csv.rb +++ b/app/lib/financial_transactions_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class FinancialTransactionsCsv < RenderCSV +class FinancialTransactionsCsv < RenderCsv include ApplicationHelper def header diff --git a/app/lib/invoices_csv.rb b/app/lib/invoices_csv.rb index ebd1f0a9..eecad298 100644 --- a/app/lib/invoices_csv.rb +++ b/app/lib/invoices_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class InvoicesCsv < RenderCSV +class InvoicesCsv < RenderCsv include ApplicationHelper def header diff --git a/app/lib/order_csv.rb b/app/lib/order_csv.rb index 6ec96581..b238f90c 100644 --- a/app/lib/order_csv.rb +++ b/app/lib/order_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class OrderCsv < RenderCSV +class OrderCsv < RenderCsv def header [ OrderArticle.human_attribute_name(:units_to_order), diff --git a/app/lib/order_pdf.rb b/app/lib/order_pdf.rb index 8e30ea84..164be66b 100644 --- a/app/lib/order_pdf.rb +++ b/app/lib/order_pdf.rb @@ -1,4 +1,4 @@ -class OrderPDF < RenderPDF +class OrderPdf < RenderPdf attr_reader :order def initialize(order, options = {}) @@ -55,7 +55,7 @@ class OrderPDF < RenderPDF end def group_order_article_quantity_with_tolerance(goa) - goa.tolerance > 0 ? "#{goa.quantity} + #{goa.tolerance}" : goa.quantity.to_s + goa.tolerance > 0 ? "#{goa.quantity} + #{goa.tolerance}" : "#{goa.quantity}" end def group_order_article_result(goa) @@ -88,7 +88,7 @@ class OrderPDF < RenderPDF .pluck('groups.name', 'SUM(group_orders.price)', 'ordergroup_id', 'SUM(group_orders.transport)') result.map do |item| - [item.first || stock_ordergroup_name] + item[1..] + [item.first || stock_ordergroup_name] + item[1..-1] end end @@ -103,7 +103,7 @@ class OrderPDF < RenderPDF def each_ordergroup_batch(batch_size) offset = 0 - loop do + while true go_records = ordergroups(offset, batch_size) break unless go_records.any? diff --git a/app/lib/ordergroups_csv.rb b/app/lib/ordergroups_csv.rb index 71a9aaa7..f6fba00f 100644 --- a/app/lib/ordergroups_csv.rb +++ b/app/lib/ordergroups_csv.rb @@ -1,4 +1,4 @@ -class OrdergroupsCsv < RenderCSV +class OrdergroupsCsv < RenderCsv include ApplicationHelper def header diff --git a/app/lib/render_csv.rb b/app/lib/render_csv.rb index b900f1f7..1f20b075 100644 --- a/app/lib/render_csv.rb +++ b/app/lib/render_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class RenderCSV +class RenderCsv include ActionView::Helpers::NumberHelper def initialize(object, options = {}) diff --git a/app/lib/render_pdf.rb b/app/lib/render_pdf.rb index aed04011..479dc4a3 100644 --- a/app/lib/render_pdf.rb +++ b/app/lib/render_pdf.rb @@ -52,7 +52,7 @@ class RotatedCell < Prawn::Table::Cell::Text end end -class RenderPDF < Prawn::Document +class RenderPdf < Prawn::Document include ActionView::Helpers::NumberHelper include ApplicationHelper diff --git a/app/lib/users_csv.rb b/app/lib/users_csv.rb index 56ec3a23..a7d54698 100644 --- a/app/lib/users_csv.rb +++ b/app/lib/users_csv.rb @@ -1,4 +1,4 @@ -class UsersCsv < RenderCSV +class UsersCsv < RenderCsv include ApplicationHelper def header diff --git a/config/initializers/zeitwerk.rb b/config/initializers/zeitwerk.rb index 155d7702..9c505a26 100644 --- a/config/initializers/zeitwerk.rb +++ b/config/initializers/zeitwerk.rb @@ -1,3 +1,5 @@ +# config/initializers/zeitwerk.rb ActiveSupport::Dependencies .autoload_paths .delete("#{Rails.root}/app/controllers/concerns") + \ No newline at end of file