Skip to content

Commit e62932c

Browse files
committed
chore: fix cops for learning outcome csvs
1 parent 836e247 commit e62932c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/models/feedback/feedback_chip.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def self.import_feedback_chips_from_csv(file, context_type, context)
168168

169169
CSV.parse(data,
170170
headers: true,
171-
header_converters: [->(i) { i.nil? ? '' : i }, :downcase, ->(hdr) { hdr.strip unless hdr.nil? }],
172-
converters: [->(body) { body.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') unless body.nil? }]).each do |row|
171+
header_converters: [->(i) { i.nil? ? '' : i }, :downcase, ->(hdr) { hdr&.strip }],
172+
converters: [->(body) { body&.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') }]).each do |row|
173173
# Make sure we're not looking at the header or an empty line
174174
next if row[0] =~ /unit_code/
175175

app/models/task_definition.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ def import_outcomes_from_csv(file)
317317

318318
CSV.parse(data,
319319
headers: true,
320-
header_converters: [->(i) { i.nil? ? '' : i }, :downcase, ->(hdr) { hdr.strip unless hdr.nil? }],
321-
converters: [->(body) { body.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') unless body.nil? }]).each do |row|
320+
header_converters: [->(i) { i.nil? ? '' : i }, :downcase, ->(hdr) { hdr&.strip }],
321+
converters: [->(body) { body&.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') }]).each do |row|
322322
# Make sure we're not looking at the header or an empty line
323323
next if row[0] =~ /abbreviation/
324324

0 commit comments

Comments
 (0)