diff --git a/changelog.d/20240705_121059_mzhiltso_assignee_from_quality_reports_in_ui.md b/changelog.d/20240705_121059_mzhiltso_assignee_from_quality_reports_in_ui.md new file mode 100644 index 000000000000..63f6f56d4b05 --- /dev/null +++ b/changelog.d/20240705_121059_mzhiltso_assignee_from_quality_reports_in_ui.md @@ -0,0 +1,5 @@ +### Changed + +- Quality analytics page will now report job assignees from quality reports + instead of current job assignees + () diff --git a/cvat-core/src/quality-report.ts b/cvat-core/src/quality-report.ts index 13cbb1e5c7cf..f7d52957f99c 100644 --- a/cvat-core/src/quality-report.ts +++ b/cvat-core/src/quality-report.ts @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT import { SerializedQualityReportData } from './server-response-types'; +import User from './user'; export interface QualitySummary { frameCount: number; @@ -36,6 +37,7 @@ export default class QualityReport { #target: string; #createdDate: string; #gtLastUpdated: string; + #assignee: User | null; #summary: Partial; constructor(initialData: SerializedQualityReportData) { @@ -47,6 +49,12 @@ export default class QualityReport { this.#gtLastUpdated = initialData.gt_last_updated; this.#createdDate = initialData.created_date; this.#summary = initialData.summary; + + if (initialData.assignee) { + this.#assignee = new User(initialData.assignee); + } else { + this.#assignee = null; + } } get id(): number { @@ -77,6 +85,10 @@ export default class QualityReport { return this.#createdDate; } + get assignee(): User | null { + return this.#assignee; + } + get summary(): QualitySummary { return { frameCount: this.#summary.frame_count, diff --git a/cvat-core/src/server-response-types.ts b/cvat-core/src/server-response-types.ts index 07a869b43a0a..a85a157ec8e3 100644 --- a/cvat-core/src/server-response-types.ts +++ b/cvat-core/src/server-response-types.ts @@ -296,6 +296,7 @@ export interface SerializedQualityReportData { target: string; created_date?: string; gt_last_updated?: string; + assignee?: SerializedUser | null; summary?: { frame_count: number; frame_share: number; diff --git a/cvat-ui/src/components/analytics-page/task-quality/job-list.tsx b/cvat-ui/src/components/analytics-page/task-quality/job-list.tsx index 3e3dbc04cbfd..c4b12774f541 100644 --- a/cvat-ui/src/components/analytics-page/task-quality/job-list.tsx +++ b/cvat-ui/src/components/analytics-page/task-quality/job-list.tsx @@ -67,12 +67,12 @@ function JobListComponent(props: Props): JSX.Element { function collectUsers(path: string): ColumnFilterItem[] { return Array.from( new Set( - jobs.map((job: any) => { - if (job[path] === null) { + Object.values(jobsReports).map((report: QualityReport) => { + if (report[path] === null) { return null; } - return job[path].username; + return report[path].username; }), ), ).map((value: string | null) => ({ text: value || 'Is Empty', value: value || false })); @@ -127,8 +127,8 @@ function JobListComponent(props: Props): JSX.Element { dataIndex: 'assignee', key: 'assignee', className: 'cvat-job-item-assignee', - render: (jobInstance: any): JSX.Element => ( - {jobInstance?.assignee?.username} + render: (report: QualityReport): JSX.Element => ( + {report?.assignee?.username} ), sorter: sorter('assignee.assignee.username'), filters: collectUsers('assignee'), @@ -232,7 +232,7 @@ function JobListComponent(props: Props): JSX.Element { job: job.id, download: job, stage: job, - assignee: job, + assignee: report, quality: report, conflicts: report, frame_intersection: report,