Disclaimer: The Data Explorer contains outdated data! Go to http://<your SE site>/review
to see live info about the badge.
I've created a query loosely based on waffles' query here. It works by checking all the revisions you've made to titles and posts, grouping by the ID of the post. Multiple edits to a single post don't count. Note I've made it for Copy Editor rather than Strunk & White, but you can modify it easily.
Problems it avoids:
- Counting only the edits you've made that are also the last edit made (artlung's suffers from this)
- Counting title and post edits separately (which simply summing your changes in the PostHistory table would do even with grouping by the timestamp, since they can be off by milliseconds)
- Counting edits to your own posts
- Counting multiple edits to the same post
I'm rusty and this isn't my day job, note the crappy outer select :P. Code below if anyone wants to take a crack at improving it.
-- Copy Editor Progress
-- This query returns the number of edits you still need to
-- get the Copy Editor badge.
DECLARE @userid int = ##UserId##
SELECT 500 - COUNT(*) AS EditsLeft
FROM (
SELECT PostID
FROM PostHistory ph
WHERE PostHistoryTypeId IN (4,5)
AND PostId NOT IN (
SELECT p.Id
FROM Posts p
WHERE p.OwnerUserId = ph.UserId
)
AND UserID = @userid
GROUP BY PostID
) AS bar
Users > Editors > All
and search for your own name, does this not show your total number of edits that do count towards S&W?