-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore logic which is still necessary
- Loading branch information
1 parent
407f809
commit b4b8cc3
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
app/domain/pbs/export/tabular/people/participation_nds_row.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2012-2023, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_pbs and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_pbs. | ||
|
||
module Pbs::Export::Tabular::People::ParticipationNdsRow | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
alias_method_chain :first_language, :language | ||
end | ||
|
||
def first_language_with_language | ||
lang = entry.language.presence | ||
lang ? lang.upcase : 'DE' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
spec/domain/export/tabular/people/participation_nds_row_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2012-2023, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_pbs and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_pbs. | ||
|
||
require 'spec_helper' | ||
|
||
describe Export::Tabular::People::ParticipationNdsRow do | ||
|
||
let(:participation) { Fabricate(:pbs_participation, person: person, event: events(:top_course)) } | ||
|
||
let(:row) { described_class.new(participation) } | ||
|
||
context 'with language' do | ||
let(:person) { Fabricate(:person, language: 'it') } | ||
it { expect(row.fetch(:first_language)).to eq 'IT' } | ||
end | ||
|
||
context 'without language' do | ||
let(:person) { Fabricate(:person, language: nil) } | ||
it { expect(row.fetch(:first_language)).to eq 'DE' } | ||
end | ||
end |