This commit is contained in:
2026-08-07 20:43:24 +00:00
parent 1f3de0d7ff
commit 7dd2513cd8
@@ -62,7 +62,12 @@ SELECT
AS payment_plan_balance_cents, AS payment_plan_balance_cents,
COUNT(DISTINCT d.student_id) FILTER (WHERE d.is_past_due) AS delinquent_accounts, COUNT(DISTINCT d.student_id) FILTER (WHERE d.is_past_due) AS delinquent_accounts,
CASE CASE
WHEN public.is_billing_admin() OR public.is_auditor() THEN -- Everyone who can genuinely read public.scholarships: billing admins and
-- auditors by policy, plus service_role (and superusers) by RLS bypass —
-- without that last arm, server-side reporting would see NULL too.
WHEN public.is_billing_admin()
OR public.is_auditor()
OR pg_has_role(current_user, 'service_role', 'MEMBER') THEN
COALESCE(( COALESCE((
SELECT SUM(sc.award_amount_cents) SELECT SUM(sc.award_amount_cents)
FROM public.scholarships sc FROM public.scholarships sc