Breakdown of anonymously suggested edits


Please login or register to vote for this query.

(click on this box to dismiss)

Gives an overview of how helpful anonymous editors are.


Q&A for passionate videogamers on all platforms

-- Temporary table for all non-pending anonymous edits.
declare @AnonEdits table (Id int, Approved bit, Improved bit)

insert @AnonEdits (Id, Approved, Improved)
  s.Id as Id,
  case when s.ApprovalDate is not null then 1 else 0 end as Approved,
  max(case when v.UserId = -1 then 1 else 0 end) as Improved -- voted on by Community?
  SuggestedEdits s, SuggestedEditVotes v
  s.Id = v.SuggestedEditId
  and s.OwnerUserId is null -- anonymous
  and (s.ApprovalDate is not null or s.RejectionDate is not null) -- not pending
  by s.Id, s.ApprovalDate -- welp

-- all them variables
declare @TotalEdits int, @ApprovedEdits int, @ImprovedEdits int, @RejectedEdits int, @ApprovedImproved int, @RejectedImproved int

-- select us some data
  @TotalEdits = count(*),
  @ApprovedEdits = sum(case when Approved = 1 then 1 else 0 end),
  @ImprovedEdits = sum(case when Improved = 1 then 1 else 0 end),
  @ApprovedImproved = sum(case when Approved = 1 and Improved = 1 then 1 else 0 end)
from @AnonEdits

-- calculate the rest
  @RejectedEdits = @TotalEdits - @ApprovedEdits,
  @RejectedImproved = @ImprovedEdits - @ApprovedImproved

-- display it
  @TotalEdits as 'Total anonymous edits',
  @ApprovedEdits as 'Approved edits',
  @RejectedEdits as 'Rejected edits',
  cast(@ImprovedEdits as varchar) + ' total (' + cast(@ApprovedImproved as varchar) + ' approved, ' + cast(@RejectedImproved as varchar) + ' rejected)' as 'Improved edits',
  @ApprovedEdits - @ApprovedImproved as 'Approved as-is',
  @RejectedEdits - @RejectedImproved as 'Rejected as-is'

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results