There’s this piece of code that’s been bugging me:
For the life of me, I cannot figure out why the posts made in the time period is multiplied by the percentage of required posts read, then taken as the minimum value. If the intention here is the percentage of posts read, then wouldn’t it be the posts read / number of posts, multiplied by 100?
Supposing there have been 9 posts in the last x days, and the setting only requires 2, then shouldn’t the method simply return 2 since it’s less than the post cap?
The tl3_requires_posts_read site setting is a percentage. Let’s say it’s 10. While the cap keeps the requirement bound to something reasonable. Let’s say it’s 100.
“A user must read 10% of all the posts in the period, but not more than 100”
Let’s say there were 500 posts made in that period.
In that case, it’d take reading 50 posts to meet the requirement (10% of those posts)
The arithmetic happens to be done as 500 * (10.0/100.0) to get the result 50
The cap sets an upper bound though.
If your cap is bigger than 50 (say 100), then it has no effect.
[50, 100].min returns 50
But what if there are 100,000 posts one month? In that case, without the cap, someone would have to read 10,000 posts to meet the requirement.