Files
lincodex/backend/db/queries/candidate_search.sql
T

19 lines
927 B
SQL

-- Reads that only the match search needs. The visibility of the candidates and
-- their permitted evidence come from the card and evidence queries, which are
-- the single copy of those barriers; this file adds no candidate-facing read.
-- The number of candidates who hold each given category from a source that is
-- not a synthetic demonstration, which is the size of the comparable real
-- cohort that a percentile needs. It returns counts only, for the pairs the
-- caller passes as "specialization/grade", and no row for a pair nobody holds.
-- name: CountRealComparableCategories :many
SELECT
category.specialization,
category.grade,
count(*)::bigint AS candidates
FROM candidate_assessment_categories AS category
WHERE
category.source <> 'synthetic_demo'
AND (category.specialization || '/' || category.grade) = any(sqlc.arg(categories)::text [])
GROUP BY category.specialization, category.grade;