update first_log_in

This commit is contained in:
carlad 2015-12-04 12:53:51 +01:00
parent 98080beeaf
commit a7fa8f6a6f

View File

@ -160,7 +160,10 @@ class Travis::Api::App
def check_first_login(user)
return if user.first_logged_in_at
puts "this is the first log in!!"
puts "******** This is the first log in for " + user.login + " **********"
# update user
timestamp = Time.now
user.update_attributes(first_logged_in_at: timestamp)
# send event to customer.io
customerio = Customerio::Client.new(Travis.config.customerio.site_id, Travis.config.customerio.api_key, :json => true)
payload = {
@ -170,9 +173,9 @@ class Travis::Api::App
:email => user.email,
:created_at => user.created_at.to_i,
:github_id => user.github_id,
:education => user.education }
:education => user.education,
:first_logged_in_at => timestamp.to_i}
customerio.identify(payload)
# user.update_attributes(first_logged_in_at: Time.now)
end
def serialize_user(user)