pingcap/ossinsight-lite

Most used language chart is misleading

Opened this issue · 0 comments

https://github.com/pingcap/ossinsight-lite/blob/main/collections/contribution-most-used-languages/template.sql

WITH languages AS (
    SELECT language, COUNT(*) as count
    FROM pull_requests pr
    JOIN repos r on pr.repo_id = r.id
    WHERE pr.user_id = (SELECT id FROM curr_user LIMIT 1) AND r.language IS NOT NULL
    GROUP BY language
    ORDER BY count DESC
), total AS (
    SELECT SUM(count) as total FROM languages
)
SELECT language, count, ROUND(count * 100.0 / total, 2) as precentage
FROM languages, total
ORDER BY count DESC

In fact, this is the contributed repo's main language but not user pushed language of code.