Socratic badge progress

1

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

-- Note: SEDE doesn't include (enough) information about deleted posts
-- to take the full criteria described here:
-- https://meta.stackexchange.com/q/234259/295232
-- into account.

CREATE TABLE #questions (CreationDate DATETIME, Score INT, Closed BIT);

INSERT INTO #questions
SELECT DATEADD(DAY, DATEDIFF(DAY, 0, CreationDate), 0), Score,
  CASE WHEN ClosedDate IS NULL THEN 0 ELSE 1 END
  FROM Posts  
  WHERE OwnerUserId = ##UserId:int##
    AND PostTypeId = 1

SELECT 'Question record score (needs to be >= 0.5)',
  CASE WHEN (SELECT COUNT(*) FROM #questions) = 0 THEN NULL ELSE
  ROUND(((SELECT COUNT(*) FROM #questions)
       - (SELECT COUNT(*) FROM #questions WHERE Score < 0)
       - (SELECT COUNT(*) FROM #questions WHERE Closed = 1))
  / CAST((SELECT COUNT(*) FROM #questions) AS FLOAT), 2)
  END

UNION ALL

SELECT 'Days with well-received questions', 
(SELECT COUNT(DISTINCT(p.CreationDate))
  FROM #questions AS p
  LEFT OUTER JOIN #questions AS n ON p.CreationDate = n.CreationDate
                                 AND n.Score < 0
  LEFT OUTER JOIN #questions AS c ON p.CreationDate = c.CreationDate
                                 AND c.Closed = 1
  WHERE p.Score > 0
    AND p.Closed = 0
    AND n.CreationDate IS NULL
    AND c.CreationDate IS NULL)

Enter Parameters

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