Skip to content

Instantly share code, notes, and snippets.

@briu
Last active August 29, 2016 09:44
Show Gist options
  • Save briu/b052ae8c26086a8990f6b136e88c504c to your computer and use it in GitHub Desktop.
Save briu/b052ae8c26086a8990f6b136e88c504c to your computer and use it in GitHub Desktop.
interview
class CallCenter < ActiveRecord::Base
def self.prepare_to_work
all.each do |call_center|
if call_center.name == 'test1'
call_center.check_callmanagers
call_center.update_attributes(handled: 0)
elsif call_center.name == 'test2'
call_center.send_letters_to_customers
call_center.remove_managers
if call_center.max_attempts > 2
call_center.update_attributes(handled: 100)
User.find_by(email: call_center.head.email).work!
end
elsif call_center.name == 'test3'
call_center.send_letters_to_customers
call_center.remove_managers
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment