fix(ticket): hide details for empty assignment lots
This commit is contained in:
@@ -146,7 +146,9 @@ export function TicketAssignmentsCard({
|
||||
ticketId,
|
||||
initialAssignments,
|
||||
);
|
||||
const assignments = assignmentsQuery.data?.items ?? [];
|
||||
const assignments = (assignmentsQuery.data?.items ?? []).filter(
|
||||
(assignment) => assignment.item_count > 0,
|
||||
);
|
||||
const selectedAssignment =
|
||||
assignments.find((assignment) => assignment.id === selectedAssignmentId) ??
|
||||
assignments[0];
|
||||
@@ -178,7 +180,7 @@ export function TicketAssignmentsCard({
|
||||
</CardDescription>
|
||||
</div>
|
||||
{assignmentsQuery.data ? (
|
||||
<Badge variant="secondary">{assignmentsQuery.data.total}</Badge>
|
||||
<Badge variant="secondary">{assignments.length}</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
</CardHeader>
|
||||
|
||||
@@ -20,8 +20,7 @@ import { DetectionDiscardDialog } from './DetectionDiscardDialog';
|
||||
interface TicketClassDetectionPreviewProps {
|
||||
ticketId: string;
|
||||
videoId?: string | null;
|
||||
assignmentId?: number;
|
||||
totalCount?: number;
|
||||
assignmentId: number;
|
||||
}
|
||||
|
||||
function DetectionMetadataBar({
|
||||
@@ -96,7 +95,6 @@ export function TicketClassDetectionPreview({
|
||||
ticketId,
|
||||
videoId,
|
||||
assignmentId,
|
||||
totalCount,
|
||||
}: TicketClassDetectionPreviewProps) {
|
||||
const [currentIndex, setCurrentIndex] = useState(0);
|
||||
const [isDiscardDialogOpen, setIsDiscardDialogOpen] = useState(false);
|
||||
@@ -122,8 +120,7 @@ export function TicketClassDetectionPreview({
|
||||
const detectionResult = detectionsQuery.data;
|
||||
const activeDetection = detectionResult?.items[0];
|
||||
const confirmedDetectionCount = detectionResult?.total;
|
||||
const detectionCount =
|
||||
detectionResult?.total ?? (assignmentId ? 0 : (totalCount ?? 0));
|
||||
const detectionCount = detectionResult?.total ?? 0;
|
||||
const activeVisual = getDefectVisual(
|
||||
activeDetection?.detection.class_name ?? '',
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { TicketClassDetectionPreview } from './TicketClassDetectionPreview';
|
||||
interface TicketDefectClassTabsProps {
|
||||
ticketId: string;
|
||||
ticket?: TicketOverviewDetail;
|
||||
assignmentId?: number;
|
||||
assignmentId: number;
|
||||
}
|
||||
|
||||
export function TicketDefectClassTabs({
|
||||
@@ -61,7 +61,6 @@ export function TicketDefectClassTabs({
|
||||
ticketId={ticketId}
|
||||
videoId={previewVideoId}
|
||||
assignmentId={assignmentId}
|
||||
totalCount={ticket?.ai_result.detection_count}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user