fix: tkg.rs avg_confidence moved before props construction + schema.rs ON CONFLICT backfill derived fields
- tkg.rs: avg_confidence calculation moved to line 1207 (before props json) - tkg.rs: Added 'avg_confidence' to props json (round4) - schema.rs: ON CONFLICT DO UPDATE expanded to backfill start_frame, end_frame, frame_count, key_frame, key_face, avg_confidence from tkg_nodes.properties This fixes trace_profiles.avg_confidence always being NULL, and enables automatic self-healing when upsert_trace_profile is called from any caller.
This commit is contained in:
@@ -1204,6 +1204,12 @@ async fn build_face_track_nodes_from_qdrant(
|
||||
(0.0, 0.0, 0.0)
|
||||
};
|
||||
|
||||
let avg_confidence = if agg.frame_count > 0 {
|
||||
agg.sum_confidence / agg.frame_count as f64
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
let props = serde_json::json!({
|
||||
"trace_id": tid,
|
||||
"frame_count": agg.frame_count,
|
||||
@@ -1221,6 +1227,7 @@ async fn build_face_track_nodes_from_qdrant(
|
||||
"avg_pitch": (avg_pitch * 1000.0).round() / 1000.0,
|
||||
"avg_roll": (avg_roll * 1000.0).round() / 1000.0,
|
||||
"pose_count": pose_count,
|
||||
"avg_confidence": (avg_confidence * 1000.0).round() / 1000.0,
|
||||
"status": "pending",
|
||||
});
|
||||
|
||||
@@ -1250,12 +1257,6 @@ async fn build_face_track_nodes_from_qdrant(
|
||||
.flatten()
|
||||
.unwrap_or(30.0);
|
||||
|
||||
let avg_confidence = if agg.frame_count > 0 {
|
||||
agg.sum_confidence / agg.frame_count as f64
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
let mut trace_profile = crate::core::file_profile::FaceTraceProfile::new(
|
||||
file_uuid,
|
||||
*tid,
|
||||
|
||||
Reference in New Issue
Block a user