fix(aihr): scope pilot SOP metrics
This commit is contained in:
@@ -245,9 +245,9 @@ check_pilot_samples() {
|
||||
JOIN latest_calibration latest ON latest.id = c.id
|
||||
WHERE c.tenant_id = '$pilot_tenant'")"
|
||||
read -r calibration_count calibration_matched <<<"$calibration_stats"
|
||||
sop_total="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_sop_answer_review WHERE tenant_id = '$pilot_tenant' AND status = '已评审' AND reviewed_time >= '${pilot_start} 00:00:00' AND reviewed_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")"
|
||||
sop_usable="$(pilot_sql_scalar "SELECT COALESCE(SUM(CASE WHEN usable = 1 THEN 1 ELSE 0 END), 0) FROM aihr_sop_answer_review WHERE tenant_id = '$pilot_tenant' AND status = '已评审' AND reviewed_time >= '${pilot_start} 00:00:00' AND reviewed_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")"
|
||||
sop_pending="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_sop_answer_review WHERE tenant_id = '$pilot_tenant' AND status <> '已评审' AND create_time >= '${pilot_start} 00:00:00' AND create_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")"
|
||||
sop_total="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_sop_answer_review WHERE tenant_id = '$pilot_tenant' AND status = '已评审' AND (LOWER(TRIM(COALESCE(category, ''))) = 'sop' OR category LIKE '%SOP%') AND reviewed_time >= '${pilot_start} 00:00:00' AND reviewed_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")"
|
||||
sop_usable="$(pilot_sql_scalar "SELECT COALESCE(SUM(CASE WHEN usable = 1 THEN 1 ELSE 0 END), 0) FROM aihr_sop_answer_review WHERE tenant_id = '$pilot_tenant' AND status = '已评审' AND (LOWER(TRIM(COALESCE(category, ''))) = 'sop' OR category LIKE '%SOP%') AND reviewed_time >= '${pilot_start} 00:00:00' AND reviewed_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")"
|
||||
sop_pending="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_sop_answer_review WHERE tenant_id = '$pilot_tenant' AND status <> '已评审' AND (LOWER(TRIM(COALESCE(category, ''))) = 'sop' OR category LIKE '%SOP%') AND create_time >= '${pilot_start} 00:00:00' AND create_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")"
|
||||
satisfaction_count="$(pilot_sql_scalar "
|
||||
$org_identity_cte,
|
||||
formal_sessions AS (
|
||||
|
||||
@@ -72,7 +72,7 @@ CREATE TABLE aihr_practice_calibration (
|
||||
original_score int, corrected_score int, create_time datetime
|
||||
);
|
||||
CREATE TABLE aihr_sop_answer_review (
|
||||
tenant_id varchar(20), status varchar(30), usable tinyint,
|
||||
tenant_id varchar(20), category varchar(100), status varchar(30), usable tinyint,
|
||||
reviewed_time datetime, create_time datetime
|
||||
);
|
||||
|
||||
@@ -133,10 +133,12 @@ INSERT INTO aihr_practice_calibration (tenant_id,session_id,original_score,corre
|
||||
('000000','unsafe-inside',80,40,'2026-07-08 11:00:00'),
|
||||
('000000','e-out',80,40,'2026-07-06 11:00:00');
|
||||
INSERT INTO aihr_sop_answer_review VALUES
|
||||
('000000','已评审',1,'2026-07-08 12:00:00','2026-07-08 11:00:00'),
|
||||
('000000','已评审',0,'2026-07-06 12:00:00','2026-07-06 11:00:00'),
|
||||
('000000','待评审',NULL,NULL,'2026-07-08 13:00:00'),
|
||||
('000000','待评审',NULL,NULL,'2026-07-06 13:00:00');
|
||||
('000000','sop','已评审',1,'2026-07-08 12:00:00','2026-07-08 11:00:00'),
|
||||
('000000','sop','已评审',0,'2026-07-06 12:00:00','2026-07-06 11:00:00'),
|
||||
('000000','sop','待评审',NULL,NULL,'2026-07-08 13:00:00'),
|
||||
('000000','training','已评审',0,'2026-07-08 12:30:00','2026-07-08 11:30:00'),
|
||||
('000000','training','待评审',NULL,NULL,'2026-07-08 13:00:00'),
|
||||
('000000','training','待评审',NULL,NULL,'2026-07-06 13:00:00');
|
||||
SQL
|
||||
|
||||
export AIHR_PILOT_DB="$TEST_DB"
|
||||
|
||||
Reference in New Issue
Block a user