How much reputation are you getting from your past work?

4

Please login or register to vote for this query.

(click on this box to dismiss)

Take the "unexpected" reputation coming from your answers from last month. Suppose now you constantly get those, and figure out how much rep per day you are getting for your past work without "working for it" on that given day

Moderators

Q&A for community managers, administrators, and moderators

-- How much reputation are you getting from your past work?
-- Take the "unexpected" reputation coming from your answers from last month.
-- Suppose now you constantly get those, and figure out how much rep per day
-- you are getting for your past work

declare @UserId int = ##UserId##;

SELECT @UserId AS [User Link], @UserId AS Id, Reputation, AgeInDays AS AccountAgeInDays,CAST(CAST(RepFromPast AS float)/AgeInDays AS int) AS OldReputationPerDay
  FROM 
      (
      SELECT @UserId AS Id, SUM(Reputation) AS RepFromPast 
        FROM (
            SELECT CASE WHEN VoteTypeId = 2 THEN 10 ELSE -2 END AS Reputation    
              FROM
                Votes v JOIN Posts p ON v.PostId=p.Id JOIN Posts parents ON p.ParentId=parents.Id
              WHERE p.PostTypeId = 2
                AND p.OwnerUserId = @UserId
                AND v.VoteTypeId In (2,3)
                AND datediff(day, p.CreationDate,v.CreationDate) > 30
                AND p.ownerUserId != parents.ownerUserId
          ) AS RepCounts
        ) As RepAndUserCount
      JOIN 
        (
        SELECT Id, Reputation, CONVERT(int, GETDATE() - CreationDate) as AgeInDays
          FROM Users
          WHERE Users.Id = @UserId
        ) AS AccountAge
      ON RepAndUserCount.Id=AccountAge.Id

Enter Parameters

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