12_generate_custom_csv_file #58

Open
philipp wants to merge 59 commits from 12_generate_custom_csv_file into develop
11 changed files with 15 additions and 13 deletions
Showing only changes of commit 50bf879fbf - Show all commits

View file

@ -1,4 +1,4 @@
class ArticlesCsv < RenderCSV
class ArticlesCsv < RenderCsv
include ApplicationHelper
def header

View file

@ -1,6 +1,6 @@
require 'csv'
class BankTransactionsCsv < RenderCSV
class BankTransactionsCsv < RenderCsv
include ApplicationHelper
def header

View file

@ -1,6 +1,6 @@
require 'csv'
class FinancialTransactionsCsv < RenderCSV
class FinancialTransactionsCsv < RenderCsv
include ApplicationHelper
def header

View file

@ -1,6 +1,6 @@
require 'csv'
class InvoicesCsv < RenderCSV
class InvoicesCsv < RenderCsv
include ApplicationHelper
def header

View file

@ -1,6 +1,6 @@
require 'csv'
class OrderCsv < RenderCSV
class OrderCsv < RenderCsv
def header
[
OrderArticle.human_attribute_name(:units_to_order),

View file

@ -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?

View file

@ -1,4 +1,4 @@
class OrdergroupsCsv < RenderCSV
class OrdergroupsCsv < RenderCsv
include ApplicationHelper
def header

View file

@ -1,6 +1,6 @@
require 'csv'
class RenderCSV
class RenderCsv
include ActionView::Helpers::NumberHelper
def initialize(object, options = {})

View file

@ -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

View file

@ -1,4 +1,4 @@
class UsersCsv < RenderCSV
class UsersCsv < RenderCsv
include ApplicationHelper
def header

View file

@ -1,3 +1,5 @@
# config/initializers/zeitwerk.rb
ActiveSupport::Dependencies
.autoload_paths
.delete("#{Rails.root}/app/controllers/concerns")