Gained reputation per answer weighted by popularity

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Gained reputation per answer weighted by popularity.
-- Answer's (reputation / popularity) ratio per post for a given user

DECLARE @UserId int = ##UserId##

SELECT 
  ROUND( (CAST(a.Score * 10 + (CASE WHEN q.AcceptedAnswerId = a.Id THEN 15 ELSE 0 END) AS float) / CAST(q.ViewCount AS float)) * 100, 3) AS [Rep/Views Ratio],
  q.Id AS [Post Link],
  CASE WHEN q.AcceptedAnswerId = a.Id THEN N'✔' ELSE '' END AS [✔],
  a.Score AS Score,
  a.Score * 10 + (CASE WHEN q.AcceptedAnswerId = a.Id THEN 15 ELSE 0 END) AS Rep,
  q.ViewCount AS Views
  
FROM Posts a
  INNER JOIN Posts q ON q.Id = a.ParentId

WHERE a.PostTypeId = 2
  AND a.OwnerUserId = @UserId
  
ORDER BY [Rep/Views Ratio] DESC

Enter Parameters

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