Distinct >3k rep users approving and rejecting suggested edits per 30-minute window (weekdays).

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

-- Distinct >3k rep users approving and rejecting suggested edits per 30-minute window (weekdays).

DECLARE @segment int = 30; -- Must be a divisor of 60, e.g. 30, 
                           -- 20, 15, 12, 10, 6, 5, 4, 3, 2, 1.

SELECT
  Time,
  COUNT(*) Users
FROM
(
  SELECT DISTINCT -- Remove DISTINCT to count moderation activity
                  -- instead of active users.
    UserId,
    DATEADD(mi, DATEPART(hh, v.CreationDate)*60
      + DATEPART(mi, v.CreationDate)/@segment*@segment, 0) AS Time
  FROM SuggestedEditVotes v
  INNER JOIN Users ON Users.Id = v.UserId
  WHERE Users.Reputation >= 3000 AND
        ((DATEPART(dw, v.CreationDate) + @@DATEFIRST) % 7)
            NOT IN (0, 1)
) X
GROUP BY Time
ORDER BY Time

-- The results leave a default date (instead of CAST AS TIME)
-- because the graphing module can only graph full datetimes.

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results