Merge pull request #138 from ZeusWPI/frecencydebtupdate

Update frecencydebt
This commit is contained in:
Wout Schellaert 2019-09-07 12:05:57 +02:00 committed by GitHub
commit 009bdeec76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,7 +49,7 @@ class User < ActiveRecord::Base
.pluck(:created_at)
frequency = (last_datetimes.map(&:to_time).map(&:to_i).sum / (num_orders * 10))
bonus = self.rich_privilege / 1.936
self.frecency = frequency * bonus
self.frecency = (frequency * bonus * (self.admin ? 1.01 : 1)).to_i
self.save
end