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)
clauses.append((label_clause))
if reviewed == 1:
if reviewed == 0:
clauses.append((ReviewSegment.has_been_reviewed == False))
if severity:

View File

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

View File

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

View File

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