FIX: Bulk badge awards should work even if the CSV has nil values

This commit is contained in:
romanrizzi
2020-02-27 11:07:46 -03:00
parent d461772661
commit 4673f31c75
3 changed files with 24 additions and 6 deletions

View File

@@ -55,8 +55,12 @@ class Admin::BadgesController < Admin::AdminController
csv.rewind
csv.each_line do |email_line|
batch.concat CSV.parse_line(email_line)
line_number += 1
line = CSV.parse_line(email_line).first
if line.present?
batch << line
line_number += 1
end
# Split the emails in batches of 200 elements.
full_batch = csv.lineno % (BadgeGranter::MAX_ITEMS_FOR_DELTA * batch_number) == 0