diff --git a/app/domain/export/tabular/people/participation_nds_row.rb b/app/domain/export/tabular/people/participation_nds_row.rb index fd21255..c0fd399 100644 --- a/app/domain/export/tabular/people/participation_nds_row.rb +++ b/app/domain/export/tabular/people/participation_nds_row.rb @@ -5,6 +5,8 @@ module Export::Tabular::People class ParticipationNdsRow < Export::Tabular::People::PersonRow + NDS_LANGUAGES = %w[DE FR IT].freeze + attr_reader :participation def initialize(participation, format = nil) @@ -69,7 +71,8 @@ def email_work end def first_language - "DE" + language = entry.language.presence&.to_s&.upcase + NDS_LANGUAGES.include?(language) ? language : "Andere" end def second_language diff --git a/spec/domain/export/tabular/people/participation_nds_row_spec.rb b/spec/domain/export/tabular/people/participation_nds_row_spec.rb index 57171e6..3408615 100644 --- a/spec/domain/export/tabular/people/participation_nds_row_spec.rb +++ b/spec/domain/export/tabular/people/participation_nds_row_spec.rb @@ -48,6 +48,24 @@ it { expect(row.fetch(:nationality_j_s)).to eq 'ANDERE' } end + describe 'first_language' do + context 'with supported language' do + before do + person.language = :fr + end + + it { expect(row.fetch(:first_language)).to eq 'FR' } + end + + context 'with unsupported language' do + before do + person.language = :en + end + + it { expect(row.fetch(:first_language)).to eq 'Andere' } + end + end + describe 'j_s_number format' do before do person.j_s_number = '169-55-79'