Skip to content

Commit

Permalink
fix: error regression
Browse files Browse the repository at this point in the history
  • Loading branch information
diegosteiner committed Sep 15, 2024
1 parent 7336259 commit 6697698
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/invoice_part/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ def from_payments
payed_amount = @invoice.booking.payments.where(invoice: nil, write_off: false).sum(:amount)
return [] unless payed_amount.positive? && @invoice.new_record?

apply = invoice.invoice_parts.none?

[
InvoiceParts::Text.new(apply: suggest?, label: Invoices::Deposit.model_name.human),
InvoiceParts::Add.new(apply: suggest?, label: I18n.t('invoice_parts.deposited_amount'),
amount: - payed_amount)
InvoiceParts::Text.new(apply:, label: Invoices::Deposit.model_name.human),
InvoiceParts::Add.new(apply:, label: I18n.t('invoice_parts.deposited_amount'), amount: - payed_amount)
]
end

Expand Down Expand Up @@ -72,7 +73,8 @@ def usages_to_invoice_parts(usages)
end

def usage_group_to_invoice_part(group, group_usages)
InvoiceParts::Text.new(label: group, apply: group.present? && group_usages.any?(&:apply))
apply = group.present? && group_usages.any?(&:apply)
InvoiceParts::Text.new(label: group, apply:)
end
end
end

0 comments on commit 6697698

Please sign in to comment.