Frecency out of bounds

This commit is contained in:
benji 2017-10-13 17:28:07 +02:00
parent b848f08792
commit 775fd1cb64

View file

@ -45,7 +45,7 @@ class User < ActiveRecord::Base
last_datetimes = self.orders.order(created_at: :desc) last_datetimes = self.orders.order(created_at: :desc)
.limit(num_orders) .limit(num_orders)
.pluck(:created_at) .pluck(:created_at)
self.frecency = last_datetimes.map(&:to_time).map(&:to_i).sum / num_orders self.frecency = last_datetimes.map(&:to_time).map(&:to_i).sum / (num_orders * 10)
self.save self.save
end end