Frecency out of bounds
This commit is contained in:
parent
b848f08792
commit
775fd1cb64
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue