Q&A for legal professionals, students, and others with experience or interest in law
-- Reputation points given and taken as described here: -- https://stackoverflow.com/help/whats-reputation -- TODO -- Add: -- -- * +2 for accepting of someones answer to your question -- * +2 for accepted edit -- see: https://data.stackexchange.com/stackoverflow/query/1834729 -- see: https://data.stackexchange.com/stackoverflow/query/220825 -- -- * bounty -- * +100 site Association Bonus -- * Need to limit: maximum of 200 reputation per day? -- -- -- * you vote down an answer: −1 -- * you place a bounty on a question: − full bounty amount -- * one of your posts receives 6 spam or offensive flags: −100 -- UserId:User Id -- FromDateYYYYMMDD:From Date [YYYYMMDD] -- ToDateYYYYMMDD:To Date [YYYYMMDD] declare @UserId int = ##UserId##; declare @FromDate datetime = Convert(datetime, '##FromDateYYYYMMDD##'); -- declare @ToDate datetime = Convert(datetime, '##ToDateYYYYMMDD##'); WITH a AS ( SELECT v.PostId, v.VoteTypeId, t.Name, v.CreationDate, v.BountyAmount, CASE WHEN v.VoteTypeId IN (1) THEN 15 WHEN v.VoteTypeId IN (2) THEN 10 WHEN v.VoteTypeId IN (3) THEN -2 WHEN v.VoteTypeId IN (9) THEN v.BountyAmount Else 0 END AS Points FROM Votes v JOIN VoteTypes t ON v.VoteTypeId = t.Id WHERE PostId IN ( SELECT Id FROM Posts WHERE OwnerUserId = @UserId) AND v.CreationDate >= @FromDate -- AND v.CreationDate < @ToDate ) SELECT VoteTypeId, Name AS VoteTypeName, Points AS ReputationPerVote, count(*) AS VotesCount, Points * count(*) AS ReputationTotal FROM a GROUP BY VoteTypeId, Points, Name