I saw the new Mortarboard, Epic, and Legendary badges today, and was excited to see they were applied for past activity: retro-actively, as it were. But I was also bummed to see that I hadn't earned the Legendary badge yet. And then I thought back to all those months where I hit reputation cap every single weekday, almost without exception. I must have gone nearly a year like that, and I thought that this just couldn't be right.

So I checked on it. The actual reputation calculation is complicated, and in fact the data dump doesn't include enough information to reproduce it accurately (you can't account for the -1 from making downvotes, for example). But using the October copy of the data dump this query returns 166143 candidate rows for my user id:

/***Number of Day you hit the Reputation Cap ***/
DECLARE @UserID int 
Set @UserID = 3043;
WITH BaseQuery AS (
SELECT dateadd(dd,0, datediff(dd,0, v.CreationDate)) as Day, SUM(CASE when VoteTypeId=1 then 15 when VoteTypeId=2 then 10 else -2 end) as Reputation 
FROM votes v
INNER JOIN posts p on p.Id=v.PostId And p.CommunityOwnedDate is null
WHERE v.VoteTypeId=2 and p.OwnerUserId=@UserID 
GROUP BY dateadd(dd,0, datediff(dd,0, v.CreationDate))
HAVING SUM(CASE when VoteTypeId=1 then 15 when VoteTypeId=2 then 10 else -2 end) >= 200)

SELECT count(*) FROM BaseQuery

Update: The query changed to better account for accepted answers and CommunityWiki posts, so it now shows only 143 days.

If you add accepted answers and the two months of activity since then, I should have many more candidates as well. The main thing is that the number iswas above 150.

I know that due to ordering of upvotes and downvotes it's possible that on several of those days I ended up with a score less than 200; maybe even a lot of them. However, on each of those days I had at least 21 upvotes, and I don't see enough downvotes to account for 16 days worth of -10s. This means I hit the cap at least 150 times, even if I ended up slightly lower on some of them.

Is this a bug, or by design? Personally, I think it's a bug, because after all I did hit the cap on those days. Even if I ended up lower, I left reputation on the table for upvotes that weren't counted. That said, if I'm good at anything it's seeing both sides of a situation and I can see the "by design" argument. However, if it is by design, can we change the wording for the badges so that it says something more like "finished the day at or above the cap"?

share|improve this question
    
Do you mean "Day", or "Weekday"? According to the description, it looks like it's seven days a week, not just Monday to Friday (though I'm not sure) - if you were only hitting the cap on M-F, that might be it. –  Margaret Dec 7 '09 at 3:58
    
I generally did not hit the cap on weekends, but it doesn't matter. It's not consecutive, and I have well over 150 days where I did hit the cap. –  Joel Coehoorn Dec 7 '09 at 4:10
    
I'm gonna have to put a 'status-norepro' on my own bug report, because when I edit the my query (new version shown in the question) to account for community wiki posts I'm sitting at only 143. I still think there's likely gonna be a bug here, but I can't prove it until that number goes above 150 again. –  Joel Coehoorn Dec 7 '09 at 14:48
    
New updated query is easier to modify to see which days and how much reputation. –  Joel Coehoorn Dec 19 '09 at 2:15
    
Removed status-norepro because I now have independant confirmation of the phenomenon here: meta.stackoverflow.com/questions/39375/… –  Joel Coehoorn Feb 13 '10 at 22:03
    
How does it work with the new rep calculations? Now that accepted answers are immune to the rep cap, does that mean I have to get all my "cap rep" from upvotes now? Is hitting 200 even meaningful anymore in terms of this badge calc? –  womp Mar 30 '10 at 17:08
1  
@womp I need to rewrite the query to group votes by day and take rows where count(votes) >= 20 –  Joel Coehoorn Mar 30 '10 at 20:37
add comment

3 Answers

Agreed. Incurring -1 from a downvote should not affect the definition of "hitting the reputation cap". If one has received 191 points earlier in the day, then downvotes one post and receives another upvote (191 - 1 + 10), the rep cap is still hit because not all possible points from the last post are incurred as rep (10 points available, only 9 given).

This badge calculation is also another example of where the > vs. >= ambiguity is not clearly defined. Does incurring +201 count, or just 200?

share|improve this answer
add comment

It seems my thread is a duplicate of this one, so I'll re-express my opinion here:

I'm using this greasemonkey script and today it's showing that I've reached the daily reputation limit on 51 days. But the Epic badge wasn't coming, and since I'm a relatively new user, I created a little manual statistics for the days I have => 200, and for the days that I have near 200.

The days with => 200 turned out to be 38.

And the number of days when I've actually reached the daily reputation limit (as the badge says) is 55.

Now, since on many of those days I have upvotes that are ignored due to then reaching the reputation limit, it seems a bit "unfair" to have such a big margin. The discrepancy, of course is due to:

  • my downvotes
  • deleted questions
  • users undoing accepted answers

So here's my suggestion: In order to have more proper results - i.e. at least to meet the badge description, make it work as follows:

  • count all days with reputation => 200
  • count all days where you have upvotes whose reputation was "trimmed" (due to the rep cap)
  • (optional) count all days where reputation + own downvotes => 200

The last item is optional, because in most cases it will be covered by the previous point.

Update: Got my Epic badge on the 53rd day according to the greasemonkey script.

So what is the actual algorithm?

share|improve this answer
add comment

As you've said, your rep scores in the JavaScript show 110 days.

Why not find some samples of days which would count given your calculation from the data dump, but don't count via the JavaScript data?

I assume you've taken the non-scoring of CW votes into account when doing the data dump query?

Note that if you change the "counting" script to show days of >= 190 rep gain, that shows 161 which is closer to your figure. That would suggest it could be due to downvotes you've cast, along with the occasional "downvote at the end of a 200 day".

In other words, I think you're right that it's counting days that you've ended with at least 200 rep more than you started the day with. I'd agree that would be a bug in that it's not matching the description given - but I'd be tempted to change the description rather than the code, simply because it may well be a lot more efficient to calculate that way. I guess the schema could be changed to hold a "hit the rep cap" column for each day (I'm assuming there's already a user/day/rep table somewhere for efficiency) and that would be a nicer solution...

share|improve this answer
1  
I wonder if it doesn't count as a rep cap day if you receive 30 upvotes but give out 1 downvote (not receive but give out). –  cletus Dec 7 '09 at 7:47
1  
Yes, I suspect that's the case. –  Jon Skeet Dec 7 '09 at 8:14
    
"hitting the rep cap" needn't be stored directly in the DB, as it can be calculated at the end of each day via a batch process (as a lot of other badges are calculated). However that probably implies that adding a new badge requires a global rep recalc from the beginning of time, but hey, we've been due for one of those for quite a while anyway. –  Ether Dec 7 '09 at 18:10
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .