Get all review tasks for a specific post ID or user's posts

2

Please login or register to vote for this query.

(click on this box to dismiss)

For some of the post types, it probably isn't possible to have review tasks on them, but they're listed anyway.

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

-- PostId: Post ID "Set to 0 to disable"
DECLARE @post_id INT = ##PostId:INT?0##;
-- UserId: User ID "Set to 0 to disable"
DECLARE @user_id INT = ##UserId:INT##;

SELECT 
  'site://review/' + 
  CASE ReviewTaskTypes.Id
    WHEN 1 THEN 'suggested-edits'
    WHEN 2 THEN 'close'
    WHEN 3 THEN 'low-quality-posts'
    WHEN 4 THEN 'first-posts'
    WHEN 5 THEN 'late-answers'
    WHEN 6 THEN 'reopen'
  END + '/' + CAST(ReviewTasks.Id AS nvarchar) + '| '
      + ReviewTaskTypes.Name,
  PostId as [Post Link],
  PostTypes.Name as [Post Type],
  ReviewTasks.CreationDate
FROM ReviewTasks
INNER JOIN ReviewTaskTypes on ReviewTaskTypes.Id = ReviewTasks.ReviewTaskTypeId
INNER JOIN Posts on ReviewTasks.PostId = Posts.Id
LEFT JOIN PostTypes on Posts.PostTypeId = PostTypes.Id
WHERE (ReviewTasks.PostId = @post_id
       OR Posts.OwnerUserId = @user_id
       OR (@post_id = 0 AND @user_id = 0)
      )
      AND ((##Question?1## = 1 AND PostTypes.Name = 'Question')
        OR (##Answer?1## = 1 AND PostTypes.Name = 'Answer')
        OR (##Wiki?1## = 1 AND PostTypes.Name = 'Wiki')
        OR (##TagWiki?0## = 1 AND PostTypes.Name = 'TagWiki')
        OR (##TagWikiExcerpt?0## = 1 AND PostTypes.Name = 'TagWikiExcerpt')
        OR (##ModeratorNomination?1## = 1 AND PostTypes.Name = 'ModeratorNomination')
        OR (##WikiPlaceholder?1## = 1 AND PostTypes.Name = 'WikiPlaceholder')
        OR (##PrivilegeWiki?1## = 1 AND PostTypes.Name = 'PrivilegeWiki')
      )
ORDER BY ReviewTasks.CreationDate desc

Enter Parameters

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