fix: add DISTINCT ON to cluster-results handler to prevent duplicate group cards
This commit is contained in:
+4
-2
@@ -1519,9 +1519,11 @@ pub async fn get_cluster_results_handler(
|
|||||||
.unwrap_or_else(crate::core::file_profile::FaceFilterSettings::defaults);
|
.unwrap_or_else(crate::core::file_profile::FaceFilterSettings::defaults);
|
||||||
|
|
||||||
// 1. Build face groups from TKG nodes (primary source)
|
// 1. Build face groups from TKG nodes (primary source)
|
||||||
// Use tkg_nodes.label as primary name, fallback to trace_profiles.name
|
// Use COALESCE(tn.label, tp.name) - tkg_nodes.label as primary, fallback to trace_profiles.name
|
||||||
|
// FIX: Use DISTINCT ON to prevent duplicate groups from duplicate tkg_nodes entries
|
||||||
let rows: Vec<(String, i32, Option<i32>)> = sqlx::query_as(&format!(
|
let rows: Vec<(String, i32, Option<i32>)> = sqlx::query_as(&format!(
|
||||||
"SELECT COALESCE(tn.label, tp.name) as name, \
|
"SELECT DISTINCT ON (COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int)) \
|
||||||
|
COALESCE(tn.label, tp.name) as name, \
|
||||||
COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int) as trace_id, \
|
COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int) as trace_id, \
|
||||||
tp.frame_count \
|
tp.frame_count \
|
||||||
FROM {} tn \
|
FROM {} tn \
|
||||||
|
|||||||
Reference in New Issue
Block a user