Add battery capacity ratio check (#43758)

Extend the battery-health-check SQL to flag batteries whose max_capacity
/ designed_capacity is below 80%. The new clause guards against zero
capacities and casts max_capacity to REAL for proper floating-point
division, improving detection of degraded batteries in the macOS policy.
This commit is contained in:
Allen Houchins 2026-04-20 09:23:40 -05:00 committed by GitHub
parent 3dbe90a1b6
commit 18c35e3a54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,8 @@
SELECT 1 FROM battery
WHERE condition IN ('Service Needed', 'Permanent Failure')
OR health IN ('Fair', 'Poor')
OR (max_capacity > 0 AND designed_capacity > 0
AND CAST(max_capacity AS REAL) / designed_capacity < 0.80)
);
critical: false
description: >-