How many more accepted answers do I need until Tenacious/Unsung Hero

0

Please login or register to vote for this query.

(click on this box to dismiss)

Variation of Eric's query "How unsung am I?" Zero and non-zero accepted count. Self-accepted answers do not count. How many more accepted answers with a score of zero are needed, assuming no more accepted answers with a score greater than 0, to receive both badges.

Stack Overflow

Q&A for professional and enthusiast programmers

-- How many more accepted answers do I need until Tenacious/Unsung Hero
-- Variation of Eric's query "How unsung am I?" Zero and non-zero accepted count. Self-accepted answers do not count. Shows how many more accepted answers with a score of zero are needed, assuming no more accepted answers with a score greater than 0, to receive both badges.

select Accepted, Scored, Unscored, Percentage,
    (case when 6 - Unscored > InnerUnsung.ToTenacious then 6 - Unscored else InnerUnsung.ToTenacious end) as ToTenacious,
    (case when 11 - Unscored > InnerUnsung.ToUnsungHero then 11 - Unscored else InnerUnsung.ToUnsungHero end) as ToUnsungHero
from
    (select
        count(a.Id) as Accepted,
        sum(case when a.Score = 0 then 0 else 1 end) as Scored,
        sum(case when a.Score = 0 then 1 else 0 end) as Unscored,
        sum(CASE WHEN a.Score = 0 then 1 else 0 end)*1000 / count(a.Id) / 10.0 as Percentage,
        (count(a.Id)/5-sum(case when a.Score = 0 then 1 else 0 end))/0.8 as ToTenacious,
        (count(a.Id)/4-sum(case when a.Score = 0 then 1 else 0 end))/0.75 as ToUnsungHero
    from
        Posts q
      inner join
        Posts a
      on a.Id = q.AcceptedAnswerId
    where
          a.CommunityOwnedDate is null
      and a.OwnerUserId = ##UserId##
      and q.OwnerUserId != ##UserId##
      and a.postTypeId = 2) as InnerUnsung

Enter Parameters

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