Say I hit the daily rep cap (with a great overhead, say 40 upvotes for answers, which would translate to 400 rep) and THEN get one downvote, then the day ends. At the end of the day I gained +198 rep. Does it still count that I hit the daily rep cap that day? For example, will I get the Mortarboard badge, and will I make progress on Epic and Legendary?
Many years ago, we simplified the logic for the daily reputation badges.
They only consider positive reputation changes. That means the script that awards the badge doesn't even look at downvotes, and in that regard doesn't actually pay attention to how much net reputation you earned at all. It only adds up the total reputation you gained from upvotes, accepts, bounties, and suggested edits to see if that amount is >= 200. It's even possible for a day to count if you received a series of downvotes early on but still accumulated 200 reputation after that and never even hit the reputation cap. As long as you earned 200 that day.
Note however, that the live badge progress works slightly differently. It just looks at the current net amount (including negative events) while you're on the current day, but will eventually count the day later on when it rechecks your account if downvotes caused it to drop below 200.
I don't know whether it "counts" for badge and rep report purposes... but you will lose the 2 rep. Of course, it only takes one upvote to get you back on track, even if you've had up to 5 downvotes. But it sucks for the last vote of the day to be a downvote...
It happened to me today, and I can say that previously capped points don't come back.
I had enough to get Mortarboard, but now I won't because the last one was a downvote. I started a rep recalculation, and that changed nothing :/ Note that although it shows 273, it still only counts as 198 because Mortarboard is for upvotes only.
See the second screenshot after I got another upvote:
If this happened to you, you can actually tell us if it counts!
Go to https://stackoverflow.com/reputation (or
http://(sitename)/reputation) to audit your reputation. At the very bottom of the page, it shows how many times you've hit the rep cap. Correlate those numbers based on the daily history and see if the day in question is or isn't included. Please let us know the result!
If you hit the rep cap and then get downvoted, it does NOT count for progress towards Epic / Legendary. But your Mortarboard badge won't be revoked if it's your first time hitting the repcap and you already earned it that day.
Source: I remember getting a downvote just before midnight on one of my high-rep sites which sent my daily rep down to 198 and decremented my count on Epic/Legendary back down to 1 less than it had been before that downvote.
To answer the question highlighted by @doppelgreener's bounty: yes, it counts towards those badges. Those badges only count positive reputation events, so even if you get 10 upvotes on an answer, one downvote and then another 10 upvotes, you'll qualify for the Mortarboard badge and one part of the Epic/Legendary badges.
Here is what happened to me yesterday / today - and as Jon said, "it sucks for the last vote of the day to be a downvote" (at this point, with that particular answer standing at +70/-3, it sucks a lot).
This is the tail end of my
2 240635  2 240635  2 240635  2 240635  2 240635  3 240635 [-2] -- 2014-10-08 rep +198 = 1046 2 240635 (10) -- 2014-10-09 rep +10 = 1056 ** rep today: 10 ** rep this week (2014-10-05 - 2014-10-11): 408 ** rep this month (2014-10-01 - 2014-10-31): 408 ** rep this quarter (2014-10-01 - 2014-12-31): 408 ** rep this year (2014-01-01 - 2014-12-31): 498 ** rep from bonuses: 100 ** total rep 1056 :) days represented 29 rep cap was reached via rep from upvotes *only* on 2 days earned at least 200 reputation on 1 days earned 0 reputation from suggested edits
As you can see, I ended up with 198 points for the day although I had many "uncounted" upvotes; but "rep cap was reached" counter does stand at 2, meaning that hitting the rep cap at some point in the day appears to have been enough to trigger that count (although by the end of the day I had 198 points).
It's unlikely I'll ever get to 50 days of repcap on meta - but it does make me wonder whether my counter stands at 1 ("earned at least 200 reputation on 1 days") or 2 ("rep cap was reached...") at this point.
So yes - this suggests that the last downvote can take away points that don't get restored; it does leave me wondering what happens to the rep cap counter, as the above is ambiguous.