This commit is contained in:
+3
-10
@@ -38,13 +38,6 @@ CREATE TABLE IF NOT EXISTS violation_resolutions (
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Active score: only non-negated violations in rolling 90 days
|
||||
CREATE VIEW IF NOT EXISTS active_cpas_scores AS
|
||||
SELECT
|
||||
employee_id,
|
||||
SUM(points) AS active_points,
|
||||
COUNT(*) AS violation_count
|
||||
FROM violations
|
||||
WHERE negated = 0
|
||||
AND incident_date >= DATE('now', '-90 days')
|
||||
GROUP BY employee_id;
|
||||
-- CPAS standing (active points + roll-off schedule) is computed in JS from the
|
||||
-- clean-cycle model in lib/rolloff.js; see db/database.js for why the old
|
||||
-- active_cpas_scores view was retired.
|
||||
|
||||
Reference in New Issue
Block a user