SIGN IN SIGN UP

fix: cap forum post engagement time depreciation with min instead of max

calculateEngagement applies a time-based depreciation to reddit and
hacker-news posts older than depreciatePostsOlderThanHours. The ramp
used math.Max(elapsed-threshold, maxDepreciationAfterHours), which is
always >= maxDepreciationAfterHours, so the depreciation factor was
always >= 1. As a result every post past the 7h threshold was
immediately hit with the full maxDepreciation (0.9), defeating the
gradual decay, and posts older than threshold+maxDepreciationAfterHours
got a factor > 1, producing negative engagement scores.

Use math.Min so the factor ramps from 0 to 1 over
maxDepreciationAfterHours and is capped there, restoring the intended
gradual decay and flooring engagement at 1-maxDepreciation.

Co-Authored-By: Claude <noreply@anthropic.com>
T
TowyTowy committed
cc874ad2064893504af1ef1bfd48fbe457752901
Parent: 3c86d69
Committed by Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> on 8/19/2026, 3:03:47 PM