Election Candidate Score Calculator

0

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

WITH Result AS 
(
   SELECT u.Id AS Username, 
      u.Reputation AS Reputation,
      FLOOR( 10 + 0.5*u.Reputation/1000 - 0.5*Abs(u.Reputation/1000-20) ) AS CappedRep, 
      COUNT(DISTINCT b.Name) AS BadgeCount, 
      u.LastAccessDate AS LastAccess 
   FROM Users u
   INNER JOIN Badges b ON b.UserId = u.Id
   WHERE 
--      u.Reputation >= 1000 AND 
      u.Id = ##UserID?value## AND 
      b.Name IN (
         'Civic Duty', 
         'Cleanup',
         'Constituent',
         'Convention',
         'Copy Editor',
         'Deputy',
         'Electorate',
         'Enthusiast',
         'Explainer',
         'Investor',
         'Marshal',
         'Organizer',
         'Quorum',
         'Refiner',
         'Sportsmanship',
         'Strunk & White',
         'Tag Editor',
         'Reviewer',
         'Steward', 
         'Yearling'
      )
   GROUP BY u.Id, u.Reputation, u.LastAccessDate
) 
  
SELECT 
   Username AS [User Link], 
   Reputation,
   CappedRep+BadgeCount AS 'Candidate Score', 
   CappedRep AS 'Reputation Score', 
   BadgeCount AS 'Badge Count', 
   LastAccess AS 'Last Accessed'
FROM Result 
ORDER BY
   'Candidate Score' DESC,
   Reputation DESC

Enter Parameters

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