Posts that probably need editing

5

Please login or register to vote for this query.

(click on this box to dismiss)

Updated with feedback from CodeReview.SE: https://codereview.stackexchange.com/q/176680

Latin Language

Q&A for linguists, teachers, and students wanting to discuss the finer points of the Latin language

SELECT DISTINCT PostTypes.Name AS [Post Type],
                Posts.Id AS [Post Link],
                Posts.LastActivityDate AS [Last Activity]
FROM Posts
INNER JOIN PostTypes
ON Posts.PostTypeId = PostTypes.Id
INNER JOIN Users
ON Posts.OwnerUserId = Users.Id
INNER JOIN PostHistory
ON Posts.Id = PostHistory.PostId
WHERE Posts.Score > 0 AND -- Low quality posts are probably not worth salvaging
      Users.Reputation < 4000 AND -- Posts by trusted users are exempt from editing (that is the theory anyway)
      (
          (
              Posts.PostTypeId IN (1, 3) AND
              Posts.Id <> ALL (
                  SELECT DISTINCT PostId
                  FROM PostHistory
                  WHERE PostId = PostHistory.PostId AND
                        PostHistoryTypeId IN (14, 15)
                  GROUP BY PostId
                  HAVING COUNT(PostHistoryTypeId) % 2 = 1
              )
          ) OR -- Locked posts can't be edited
          (
              Posts.PostTypeId IN (2, 3) AND
              Posts.ParentId <> ALL (
                  SELECT DISTINCT PostId
                  FROM PostHistory
                  WHERE PostId = Posts.ParentId AND
                        PostHistoryTypeId IN (14, 15)
                  GROUP BY PostId
                  HAVING COUNT(PostHistoryTypeId) % 2 = 1
              )
          ) OR
          Posts.PostTypeId IN (4, 5)
      ) AND
      (
          Posts.Title LIKE '[abcdefghijklmnopqrstuvwxyz]%' OR
          (
              Posts.Title NOT LIKE '%?' AND
              (
                  LOWER(Posts.Title) LIKE 'is %' OR
                  LOWER(Posts.Title) LIKE 'are %' OR
                  LOWER(Posts.Title) LIKE 'do[en ]%' OR
                  LOWER(Posts.Title) LIKE '%wh[aeoy]%' OR
                  LOWER(Posts.Title) LIKE '%how%'
              )
          ) OR
          (
              Posts.Body LIKE '[abcdefghijklmnopqrstuvwxyz]%' OR
              Posts.Body LIKE '%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrtuvwxyz]%' OR
              Posts.Body LIKE '%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrtuvwxyz])[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]%' OR
              Posts.Body LIKE '%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]%' OR
              Posts.Body LIKE '% i[ '']%'
          )
      ) AND
      (
          Posts.ClosedDate IS NULL OR
          DATEDIFF(day, Posts.ClosedDate, GETDATE()) BETWEEN 6 AND 90
      ) AND -- Don't edit the body of recently closed questions as doing so will bump them into the review queue
      Posts.LastActivityDate >= '2016-03-18'
ORDER BY Posts.LastActivityDate ASC

Enter Parameters

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