37

Self-edits and retags don't count toward S&W. The former are easy to filter, but what about the latter?

#! /usr/bin/perl

use warnings;
use strict;

sub num_last_editor {
  my($id) = @_;
  open my $fh, "<", "posts.xml" or die "$0: open: $!";

  my $n;
  while (<$fh>) {
    ++$n if /\bPostTypeId="1"/         &&
            /\bLastEditorUserId="$id"/ &&
           !/\bOwnerUserId="$id"/;
  }

  $n;
}

die "Usage: $0 id-num\n" unless @ARGV == 1;

my $n = num_last_editor qr/\Q$ARGV[0]/;
print "$0: last editor on $n\n";
3
  • 14
    Surely this'll take longer than just editing 100 posts would? Commented Feb 12, 2010 at 14:43
  • 1
    If you click on Users > Editors > All and search for your own name, does this not show your total number of edits that do count towards S&W?
    – Yuck
    Commented Aug 25, 2011 at 17:50
  • 2
    @Yuck No, for example balpha is listed as 552 edits at the moment but you can see he doesn't have Copy Editor (for 500 edits).
    – user154510
    Commented Sep 13, 2011 at 15:25

3 Answers 3

41

With the 2015 profile update, there is now a badge tracker on the Activity page of your profile.

On the badges overview at the top, you'll see a count of all your badges and a Next Badge section that tracks progress towards one of the badges you haven't earned. You can use this badge tracker to see how close you are to earning Strunk & White and Copy Editor. If neither badge are currently showing, click on the little gear icon to the right of the tracker:

Picture of the badge tracker

You'll see a grid showing many of the badges you can earn and your current progress:

Picture of the badge tracker badge selection screen

Selecting the badge will then allow you to track progress directly on your profile page.

3
  • 2
    I must be blind, but "You have edited a total" does not appear on the page (or html source) of stackoverflow.com/review . Did I forget a click?
    – phs
    Commented Jul 21, 2012 at 20:50
  • @phs Pick any queue from the review page, say Close Votes. Hover with your mouse pointer over the progress bar on the right just to the left of the stats, history, and review tabs to display Badge Progress.
    – Greg Bacon
    Commented Jan 28, 2015 at 18:07
  • You can also continue using the old review system method if you prefer, but I'm not sure how long that will last.
    – Troyen
    Commented Apr 18, 2015 at 7:26
17

I have added a translation to the live data using the Stack Exchange Data Explorer (SEDE):

How Many Edits Until Strunk & White

The code is:

DECLARE @UserId int = ##UserId##

SELECT 80 - COUNT(*) AS 'Edits To Strunk & White' FROM Posts
WHERE PostTypeId = 1
AND   LastEditorUserId = @UserId
AND   OwnerUserId != @UserId?
12
  • 5
    I get -4266. LOL
    – Jon Seigel
    Commented Jun 24, 2010 at 17:51
  • 4
    And that's accurate! You're -4266 edits away from when you got it. :-)
    – artlung
    Commented Jun 24, 2010 at 18:17
  • Yeah, I know, that's why I'm laughing about it. :) I had no idea how many edits I'd actually made. Turns out it's quite a lot.
    – Jon Seigel
    Commented Jun 24, 2010 at 20:35
  • @Jon: According to a rough count, you're second in edits with a ways until first.
    – Gnome
    Commented Oct 20, 2010 at 23:18
  • 1
    Why filter on PostTypeId 1 (Question)? Don't edits to answers count toward the badges?
    – Don Kirkby
    Commented Jan 15, 2011 at 0:25
  • @Don, I don't know, great question
    – artlung
    Commented Jan 15, 2011 at 16:01
  • 1
    I posted a separate question on answer edits vs. question edits: meta.stackexchange.com/q/75271/131335
    – Don Kirkby
    Commented Jan 17, 2011 at 22:54
  • 1
    This doesn't work since it only counts posts where you're the last editor. Any edit counts.
    – user154510
    Commented Sep 12, 2011 at 20:36
  • @Matthew, if you have a fix please feel free to add! Thanks.
    – artlung
    Commented Sep 12, 2011 at 21:31
  • 2
    This query doesn't work. As Matthew noted in comments to his post, you erroneously take retags into account, but they don't count towards the badge - see Matthew's comment for more detail.
    – Tomas
    Commented Sep 22, 2011 at 17:57
  • If my answer is no good, the OP needs to choose what appears to be the working answer as best. Alternately, someone with time on his or her hands can edit my query to improve it.
    – artlung
    Commented Sep 22, 2011 at 22:30
  • SEDE queries are run against an data dump from the DB that's anywhere from a few hours to a few months out of date, not the production system, so any SEDE-based approach is doomed to be less accurate than just looking at the pretty JS graph in Troyen's answer. (Yes, I realize that this answer was written before the site UI included badge progress info.)
    – Pops
    Commented Oct 18, 2012 at 19:28
10

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
10
  • that's strange - with your query I get bigger count (i.e. less edits counted!!!) than with the artlung's solution! Very strange, I'd expect quite the oposite!
    – Tomas
    Commented Sep 21, 2011 at 23:35
  • @Tomas It's because you've had lots of retags and/or rollbacks. Those are counted by artlung's but not by mine, since they don't count towards the badge (actually I'm only assuming rollbacks don't, searching for clarification...).
    – user154510
    Commented Sep 22, 2011 at 17:53
  • good note, thanks! So your query is the best :-)
    – Tomas
    Commented Sep 22, 2011 at 17:56
  • Matthew, looks like short edits (few chars) are not counted? But I don't see how you handle this in your query. Or is it because all the new edits I'm missing are too young (from today)?
    – Tomas
    Commented Oct 13, 2011 at 21:09
  • @Tomas The Data Explorer is always out of date. Data dumps are made every month or two, I believe. (Sorry for the delay in replying, I didn't get notified of your comment!)
    – user154510
    Commented Nov 21, 2011 at 20:06
  • so I get 500, but I've already received the Strunk & White badge.. whattt?
    – Ason
    Commented Jul 13, 2012 at 20:34
  • @Ason I think they made some changes recently, so I may be discluding things that they now include. What does http://stackoverflow.com/review show for you?
    – user154510
    Commented Jul 13, 2012 at 21:20
  • 82 edits, so barely making the Strunk & White, but not 500 from Copy Editor.
    – Ason
    Commented Jul 13, 2012 at 21:22
  • @Ason Oh I see, you haven't been a member long enough! The Data Explorer does not have live data in it, it's usually 1-2 months behind the live site.
    – user154510
    Commented Jul 13, 2012 at 21:24
  • makes perfect sense! sorry to bother, just wanted to check my edits (before I was guided to the review page)
    – Ason
    Commented Jul 13, 2012 at 21:26

You must log in to answer this question.

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