mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-27 04:48:57 +03:00
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:
@@ -899,6 +899,14 @@ type TrainGridProps = {
|
||||
onRefresh: () => 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({
|
||||
model,
|
||||
contentRef,
|
||||
@@ -936,7 +944,10 @@ function TrainGrid({
|
||||
return true;
|
||||
}
|
||||
|
||||
if (trainFilter.classes && !trainFilter.classes.includes(data.name)) {
|
||||
if (
|
||||
trainFilter.classes &&
|
||||
!matchesTrainClass(trainFilter.classes, data.name)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user