fix: keep user-named single-trace groups in face-groups
Single-trace groups with auto-generated names (Person_N) are filtered to unassigned, but user-named groups are kept even with 1 trace. This fixes the issue where moving traces one-by-one to a new group caused them to disappear from the UI. Before: trace → 'NewGroup' → filtered → unassigned (FS disappeared) After: trace → 'NewGroup' → shown as group (FS visible)
This commit is contained in:
+10
-7
@@ -1221,14 +1221,15 @@ pub async fn get_face_groups_handler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out single-trace "groups" — these are unclustered traces
|
// Filter out single-trace "groups" — only auto-generated Person_N names.
|
||||||
// Move them to unassigned instead of showing as separate groups
|
// User-named groups (even with 1 trace) are kept.
|
||||||
let mut filtered_groups: HashMap<String, Vec<i32>> = HashMap::new();
|
let mut filtered_groups: HashMap<String, Vec<i32>> = HashMap::new();
|
||||||
for (name, trace_ids) in groups {
|
for (name, trace_ids) in groups {
|
||||||
if trace_ids.len() > 1 {
|
let is_auto_name = name.starts_with("Person_");
|
||||||
|
if trace_ids.len() > 1 || !is_auto_name {
|
||||||
filtered_groups.insert(name, trace_ids);
|
filtered_groups.insert(name, trace_ids);
|
||||||
} else {
|
} else {
|
||||||
// Single-trace "group" → treat as unassigned
|
// Single-trace auto-generated group → treat as unassigned
|
||||||
unassigned.extend(trace_ids);
|
unassigned.extend(trace_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1331,13 +1332,15 @@ pub async fn get_cluster_results_handler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out single-trace "groups" — these are unclustered traces
|
// Filter out single-trace "groups" — only auto-generated Person_N names.
|
||||||
|
// User-named groups (even with 1 trace) are kept.
|
||||||
let mut filtered_groups: HashMap<String, Vec<i32>> = HashMap::new();
|
let mut filtered_groups: HashMap<String, Vec<i32>> = HashMap::new();
|
||||||
for (name, trace_ids) in groups {
|
for (name, trace_ids) in groups {
|
||||||
if trace_ids.len() > 1 {
|
let is_auto_name = name.starts_with("Person_");
|
||||||
|
if trace_ids.len() > 1 || !is_auto_name {
|
||||||
filtered_groups.insert(name, trace_ids);
|
filtered_groups.insert(name, trace_ids);
|
||||||
}
|
}
|
||||||
// Single-trace groups are silently dropped (not real clusters)
|
// Single-trace auto-generated groups are silently dropped
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace_id -> cluster_id mapping for frame faces
|
// trace_id -> cluster_id mapping for frame faces
|
||||||
|
|||||||
Reference in New Issue
Block a user