Skip to content

Instantly share code, notes, and snippets.

@benjohnson77
Created July 23, 2014 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjohnson77/5385f119efff85894247 to your computer and use it in GitHub Desktop.
Save benjohnson77/5385f119efff85894247 to your computer and use it in GitHub Desktop.
refactor of the process_items vs process file
def self.process_file(uploaded_file)
items = []
CSV.foreach(uploaded_file, headers: false) do |row|
items.push(row[0].to_i)
end
process_items(items)
end
def self.process_items(items)
clearancing_status = create_clearancing_status
items.each do |i|
potential_item_id = i.to_i
clearancing_error = what_is_the_clearancing_error(potential_item_id)
if clearancing_error
clearancing_status.errors << clearancing_error
else
clearancing_status.item_ids_to_clearance << potential_item_id
end
end
clearance_items(clearancing_status)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment