Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show job assignee from quality reports in UI #8123

Merged
merged 18 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Changed

- Quality analytics page will now report job assignees from quality reports
instead of current job assignees
(<https://github.com/cvat-ai/cvat/pull/8123>)
12 changes: 12 additions & 0 deletions cvat-core/src/quality-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: MIT

import { SerializedQualityReportData } from './server-response-types';
import User from './user';

export interface QualitySummary {
frameCount: number;
Expand Down Expand Up @@ -36,6 +37,7 @@ export default class QualityReport {
#target: string;
#createdDate: string;
#gtLastUpdated: string;
#assignee: User | null;
#summary: Partial<SerializedQualityReportData['summary']>;

constructor(initialData: SerializedQualityReportData) {
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions cvat-core/src/server-response-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ function JobListComponent(props: Props): JSX.Element {
function collectUsers(path: string): ColumnFilterItem[] {
return Array.from<string | null>(
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 }));
Expand Down Expand Up @@ -127,8 +127,8 @@ function JobListComponent(props: Props): JSX.Element {
dataIndex: 'assignee',
key: 'assignee',
className: 'cvat-job-item-assignee',
render: (jobInstance: any): JSX.Element => (
<Text>{jobInstance?.assignee?.username}</Text>
render: (report: QualityReport): JSX.Element => (
<Text>{report?.assignee?.username}</Text>
),
sorter: sorter('assignee.assignee.username'),
filters: collectUsers('assignee'),
Expand Down Expand Up @@ -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,
Expand Down
Loading