1

I'm implementing a reputation system similar to reddit on a personal project, and have a time decay formula I'm wanting to use for it. I'm wondering:

  • are you able to use a time-based decay formula for weighting within the activerecord reputation system? the examples I've seen show simple weighting like ":weight => 0.8"

  • if not, how should I store and update those values? I obviously don't want to run that calculation on every record on every request, but it needs to update itself fairly frequently. what's the best approach for doing that?

UPDATE: the formula I'm trying to use:

time_diff = ((Time.now - @item.created_at) / 3600).round
score = (@item.reputation_for(:votes).to_i) / (time_diff + 2)**1.5
Sean Johnson
  • 193
  • 11

1 Answers1

1

Figured it out. Used a rake task and ran it on a scheduler on Heroku.

Sean Johnson
  • 193
  • 11