Determines how many edits remain before achieving the Editor, Strunk and White and Copy Editor badges
Q&A for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing
-- 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'