fix train image filtering for a class with a dash

The backend writes a class with a `-` as `_` in train file names, since it splits those names on `-`, while a dataset folder keeps the dash. Filtering the Train grid by `half-open` compared it with `half_open` and hid every attempt. Both sides are normalized the same way now.
This commit is contained in:
Josh Hawkins
2026-09-17 16:55:39 -05:00
parent 13a3af1957
commit 03e6f54670
@@ -899,6 +899,14 @@ type TrainGridProps = {
onRefresh: () => void; onRefresh: () => void;
onDelete: (ids: string[]) => void; onDelete: (ids: string[]) => void;
}; };
// the backend writes a class with a "-" as "_" in train file names, since it
// splits those names on "-", so a dataset class may still carry the dash
function matchesTrainClass(classes: string[], name: string): boolean {
const target = name.replaceAll("-", "_");
return classes.some((item) => item.replaceAll("-", "_") === target);
}
function TrainGrid({ function TrainGrid({
model, model,
contentRef, contentRef,
@@ -936,7 +944,10 @@ function TrainGrid({
return true; return true;
} }
if (trainFilter.classes && !trainFilter.classes.includes(data.name)) { if (
trainFilter.classes &&
!matchesTrainClass(trainFilter.classes, data.name)
) {
return false; return false;
} }