Skip to content

Commit

Permalink
fix(invoice-template): Fix grouped_by_display helper method (#2649)
Browse files Browse the repository at this point in the history
## Context

Grouped by properties were not shown in the invoice: 
![Screenshot 2024-10-02 at 16 05
16](https://github.com/user-attachments/assets/d5d5f2b3-740f-4ef1-a2d6-bc4c33f0005b)


## Description

This PR fixes `FeeDisplayHelper.grouped_by_display` method that is used
in the pdf templates
  • Loading branch information
ivannovosad authored Oct 2, 2024
1 parent 46d5797 commit b2a3784
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions app/views/helpers/fee_display_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

class FeeDisplayHelper
def self.grouped_by_display(fee)
return '' unless fee.charge?
return '' if fee.charge.properties['grouped_by'].blank?
return '' if fee.grouped_by.values.compact.blank?
return '' if !fee.charge? || fee.grouped_by.values.compact.blank?

" • #{fee.grouped_by.values.compact.join(" • ")}"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/views/helpers/fee_display_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
end

it 'returns valid response' do
expect(helper.grouped_by_display(fee)).to eq('')
expect(helper.grouped_by_display(fee)).to eq(' • mercredi • week_01 • 2024')
end
end

Expand Down

0 comments on commit b2a3784

Please sign in to comment.