Class: CanvasSync::Importers::BulkImporter::UserChunker

Inherits:
Object
  • Object
show all
Defined in:
lib/canvas_sync/importers/bulk_importer.rb

Overview

Ensures that, if a User has multiple rows, one with a SIS ID is preferred. This is mainly to fix issues in legacy apps - the suggested approach for new apps is to sync and use the Pseudonymes table

Instance Method Summary collapse

Instance Method Details

#choose(key, rows) ⇒ Object



197
198
199
200
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 197

def choose(key, rows)
  row = rows.find{|r| r[:user_id].present? } || rows.last
  row.present? ? [row] : []
end

#key(row) ⇒ Object



193
194
195
# File 'lib/canvas_sync/importers/bulk_importer.rb', line 193

def key(row)
  row[:canvas_user_id]
end