TL3 "posts read" requirement seems to be miscalculating


(TechnoBear) #1

Continuing the discussion from Posts Read Discrepancy:

This seems to be a related issue.

When I posted that 11 days ago, it showed I needed to have read 882 posts in the last 100 days. The requirement now is 1245. I believe the requirement is to have read 25% of all posts made in the last 100 days, so on that basis, we should have 4,980 posts in the last 100 days. But according to the logs, we don’t even have that many in total since the forum started in January.

We did have quite a number of test threads which were deleted. At a rough guess, it looks as if these threads are still being included in the calculation for “required” posts read, but not in the logs.


Manual trigger to recalculate badges and trust level
(Jeff Atwood) #2

Maybe worth a quick look @neil to see if deleted topics / posts can cause an issue here.


(cpradio) #3

If you find something and “resolve” it, you can close the following topic as well (as it is a subset of this one).


(Neil Lalonde) #4

For the TL3 posts read requirement, I used the user visit records.

  def update_posts_read!(num_posts, now=Time.zone.now)
    if user_visit = visit_record_for(now.to_date)
      user_visit.posts_read += num_posts
      user_visit.save
      user_visit
    else
      create_visit_record!(now.to_date, num_posts)
    end
  end

Looks like the UserStat model does extra work to keep the posts read count up to date, so I’ll change it to use that instead.


(TechnoBear) #5

Since yesterday, the “total” posts shown in the Dashboard have increased by 45:

and the number I’m required to read to reach TL3 has increased by 117 to 1362, implying 5448 posts in the last 100 days.


(Neil Lalonde) #6

Not so simple. The user_stat table depends on the post_timings table, which has no created_at column, which means we have no clue when the user read the post if we use that table. Only the user_visits table allows us to find out how many posts someone read on a certain day. The result of switching to user_stat for all-time read posts for a new user is:

So, on his first day, this user read 8 posts (according to user_visits), and 10 posts (according to post_timings).

Since we have methods like PostTiming.pretend_read, I wonder if the post timing stats are inflated because of special posts that people aren’t actually reading…


(cpradio) #7

Yep, this is why I’m in a standstill in the Post Discrepancy topic. Being new to the Discourse code and to Ruby/Rails/Ember.js, etc. I’m in over my head.

I’m definitely okay with this being addressed at a better time (if it needs to involve discussion among the team on how best to address it). I personally, have no idea how to address it :frowning:

It would be very helpful if the various tables would be sync’d better, as right now it is confusing and could potentially prevent people from making TL3? (is that a safe statement to make, knowing what we know at this point?)


(Neil Lalonde) #8

Yeah this isn’t a task to get your feet wet with the Discourse code! :stuck_out_tongue:


(Jeff Atwood) #9