Progress towards editor badges

24

Please login or register to vote for this query.

(click on this box to dismiss)

Determines how many edits remain before achieving the Editor, Strunk and White and Copy Editor badges

Meta Super User

Q&A about the site for computer enthusiasts and power users

-- Progress towards editor badges
-- Determines how many edits remain before achieving the Editor, Strunk and White and Copy Editor badges

DECLARE @UserId int = ##UserId##

DECLARE theSelect CURSOR FOR
  SELECT
    COUNT(*)
  FROM
    Posts
  WHERE
    (PostTypeId = 1 OR PostTypeId = 2)
    AND LastEditorUserId = @UserId
    AND OwnerUserId != @UserId
OPEN theSelect

DECLARE @TotalEdits int
DECLARE @EditsRemainingUntilEditor int
DECLARE @EditsRemainingUntilStrunkAndWhite int
DECLARE @EditsRemainingUntilCopyEditor int

FETCH NEXT FROM theSelect into @TotalEdits

SET @EditsRemainingUntilEditor = 1 - @TotalEdits
SET @EditsRemainingUntilStrunkAndWhite = 100 - @TotalEdits
SET @EditsRemainingUntilCopyEditor = 600 - @TotalEdits

IF @EditsRemainingUntilEditor < 0
BEGIN
  SET @EditsRemainingUntilEditor = 0
END

IF @EditsRemainingUntilStrunkAndWhite < 0
BEGIN
  SET @EditsRemainingUntilStrunkAndWhite = 0
END

IF @EditsRemainingUntilCopyEditor < 0
BEGIN
  SET @EditsRemainingUntilCopyEditor = 0
END

SELECT @EditsRemainingUntilEditor AS 'Edits needed to earn Editor badge', @EditsRemainingUntilStrunkAndWhite  AS 'Edits needed to earn Strunk & White badge', @EditsRemainingUntilCopyEditor  AS 'Edits needed to earn Copy Editor badge'

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results