Fix reviewed filter (#10039)

This commit is contained in:
Nicolas Mowen 2024-02-25 15:36:18 -07:00 committed by GitHub
parent 4e5546cc78
commit 7b11ff1af6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 11 deletions

View File

@ -2426,7 +2426,7 @@ def review():
label_clause = reduce(operator.or_, label_clauses) label_clause = reduce(operator.or_, label_clauses)
clauses.append((label_clause)) clauses.append((label_clause))
if reviewed == 1: if reviewed == 0:
clauses.append((ReviewSegment.has_been_reviewed == False)) clauses.append((ReviewSegment.has_been_reviewed == False))
if severity: if severity:

View File

@ -90,7 +90,7 @@ export default function ReviewFilterGroup({
updateLabelFilter={(newLabels) => { updateLabelFilter={(newLabels) => {
onUpdateFilter({ ...filter, labels: newLabels }); onUpdateFilter({ ...filter, labels: newLabels });
}} }}
showReviewed={filter?.showReviewed || false} showReviewed={filter?.showReviewed || 0}
setShowReviewed={(reviewed) => setShowReviewed={(reviewed) =>
onUpdateFilter({ ...filter, showReviewed: reviewed }) onUpdateFilter({ ...filter, showReviewed: reviewed })
} }
@ -228,8 +228,8 @@ type GeneralFilterButtonProps = {
allLabels: string[]; allLabels: string[];
selectedLabels: string[] | undefined; selectedLabels: string[] | undefined;
updateLabelFilter: (labels: string[] | undefined) => void; updateLabelFilter: (labels: string[] | undefined) => void;
showReviewed: boolean; showReviewed?: 0 | 1;
setShowReviewed: (reviewed: boolean) => void; setShowReviewed: (reviewed?: 0 | 1) => void;
}; };
function GeneralFilterButton({ function GeneralFilterButton({
allLabels, allLabels,
@ -256,7 +256,7 @@ function GeneralFilterButton({
<Button <Button
className="capitalize flex justify-between items-center cursor-pointer w-full" className="capitalize flex justify-between items-center cursor-pointer w-full"
variant="secondary" variant="secondary"
onClick={(_) => setShowReviewed(!showReviewed)} onClick={(_) => setShowReviewed(showReviewed == 0 ? 1 : 0)}
> >
{showReviewed ? ( {showReviewed ? (
<LuCheck className="w-6 h-6" /> <LuCheck className="w-6 h-6" />

View File

@ -24,7 +24,7 @@ export default function Events() {
const onUpdateFilter = useCallback((newFilter: ReviewFilter) => { const onUpdateFilter = useCallback((newFilter: ReviewFilter) => {
setSize(1); setSize(1);
setReviewFilter(newFilter); setReviewFilter(newFilter);
}, []) }, []);
// review paging // review paging
@ -45,7 +45,7 @@ export default function Events() {
const pagedParams = { const pagedParams = {
cameras: reviewSearchParams["cameras"], cameras: reviewSearchParams["cameras"],
labels: reviewSearchParams["labels"], labels: reviewSearchParams["labels"],
reviewed: reviewSearchParams["showReviewed"] == true ? 1 : 0, reviewed: reviewSearchParams["showReviewed"],
before: lastDate, before: lastDate,
after: reviewSearchParams["after"] || timeRange.after, after: reviewSearchParams["after"] || timeRange.after,
limit: API_LIMIT, limit: API_LIMIT,
@ -56,7 +56,7 @@ export default function Events() {
const params = { const params = {
cameras: reviewSearchParams["cameras"], cameras: reviewSearchParams["cameras"],
labels: reviewSearchParams["labels"], labels: reviewSearchParams["labels"],
reviewed: reviewSearchParams["showReviewed"] == true ? 1 : 0, reviewed: reviewSearchParams["showReviewed"],
limit: API_LIMIT, limit: API_LIMIT,
before: reviewSearchParams["before"] || timeRange.before, before: reviewSearchParams["before"] || timeRange.before,
after: reviewSearchParams["after"] || timeRange.after, after: reviewSearchParams["after"] || timeRange.after,

View File

@ -25,5 +25,5 @@ export type ReviewFilter = {
labels?: string[]; labels?: string[];
before?: number; before?: number;
after?: number; after?: number;
showReviewed?: boolean; showReviewed?: 0 | 1;
}; };