FIX ALLES OOIT

This commit is contained in:
Lorin Werthen 2018-09-18 15:07:35 +02:00
parent c88dcf2b12
commit 019301e819
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0

View file

@ -44,6 +44,7 @@ class User < ActiveRecord::Base
num_orders = Rails.application.config.frecency_num_orders
last_datetimes = self.orders.order(created_at: :desc)
.limit(num_orders)
.distinct
.pluck(:created_at)
self.frecency = last_datetimes.map(&:to_time).map(&:to_i).sum / (num_orders * 10)
self.save