feat(growth): same-day 1-day baselines for new videos
Let 1-day view growth use a zero baseline for videos published today, and the first successful sample for older videos ingested today, without mixing those into 7/30-day rankings.
This commit is contained in:
1 parent
8e7ead1669
commit
c5b7185675
21 files changed
+411
-59
No files matched your search
@@ -131,6 +131,18 @@ def test_compute_growth():
|
||||
no_gap = compute_growth(100, 90, 0)
|
||||
assert no_gap.available is False
|
||||
|
||||
same_day = compute_growth(100, 90, 0, allow_zero_gap=True)
|
||||
assert same_day.available is True
|
||||
assert same_day.delta == 10
|
||||
assert same_day.per_day is None
|
||||
assert same_day.gap_days == 0
|
||||
assert abs(same_day.rate - 10 / 90) < 1e-12
|
||||
|
||||
from_zero_same_day = compute_growth(50, 0, 0, allow_zero_gap=True)
|
||||
assert from_zero_same_day.delta == 50
|
||||
assert from_zero_same_day.rate == 50.0
|
||||
assert from_zero_same_day.per_day is None
|
||||
|
||||
growth = compute_growth(1000, 800, 7)
|
||||
assert growth.available is True
|
||||
assert growth.delta == 200
|
||||
|
||||
Reference in new issue
Block a user