Estimated old and new reputation

1

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language

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

--change of upvote on question from +5 to +10
--based on https://data.stackexchange.com/math/query/1150420/estimated-old-and-new-reputation-without-offered-bounties
--does not take into account:
---- 1. daily reputation cap
---- 2. reputation from suggested edits
---- 3. reputation deduced for downvoting
---- 4. offered bounties
;  with rep_cte as
(
SELECT p.OwnerUserId AS uid,
     SUM(case v.votetypeid
             WHEN 1 THEN 15  -- accept
             WHEN 2 THEN   -- upvote
               CASE p.posttypeid
                 WHEN 1 THEN 5  -- upvote question
                 WHEN 2 THEN 10  -- upvote answer
               END
             WHEN 3 THEN -2  -- downvote
             WHEN 9 THEN BountyAmount -- collected bounty
       END) as OldRep,
       SUM(case v.votetypeid
             WHEN 1 THEN 15  -- accept
             WHEN 2 THEN 10  -- upvote
---both questions and answers now get +10 from an upvote
             WHEN 3 THEN -2  -- downvote
             WHEN 9 THEN BountyAmount -- collected bounty
       END) as NewRep
FROM Posts p INNER JOIN Votes v ON v.PostId=p.Id
WHERE (p.CommunityOwnedDate IS NULL) --not CW posts
GROUP BY p.OwnerUserId
), bounties_cte AS
---we want to subtract the offered bounties
(
SELECT
  SUM(v.BountyAmount) AS Bounties,
  u.Id AS uid,
  r.OldRep AS OldRep,
  r.NewRep AS NewRep
  FROM Votes v INNER JOIN Users u ON u.Id=v.UserId
    INNER JOIN rep_cte r ON u.Id=r.uid
  GROUP BY u.Id, r.OldRep, r.NewRep
)

SELECT TOP(##num?500##)
  r.uid AS [User Link],
  u.Reputation,
---for comparison between the estimate and the real reputation
  CASE
    WHEN (r.Bounties IS NULL) THEN r.OldRep
    ELSE CAST(r.OldRep-r.Bounties AS int)
  END AS Old,
  CASE
    WHEN (r.Bounties IS NULL) THEN r.NewRep
    ELSE CAST(r.NewRep-r.Bounties AS int)
  END AS New,
  CAST(r.NewRep-r.OldRep AS int) AS DiffRep
  FROM bounties_cte r INNER JOIN Users u ON r.uid=u.Id
  ORDER BY NewRep DESC

Enter Parameters

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