Skip to content

Commit

Permalink
Merge pull request #47 from roboduels/develop
Browse files Browse the repository at this point in the history
Use overall_from_subgrades field for the total robogrades values
  • Loading branch information
sarikaya authored Jul 4, 2024
2 parents 7325019 + 3009b79 commit 24b36df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 37 deletions.
3 changes: 3 additions & 0 deletions cvat-ui/src/actions/grades-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export const loadingGradesAsync =
front_surface_laser_grade: mapGradeValue(result?.laser_front_scan?.surface_result?.results?.grade),
front_overall_predicted_grade: mapGradeValue(result?.laser_front_scan?.overall_predicted_grade),
back_overall_predicted_grade: mapGradeValue(result?.laser_back_scan?.overall_predicted_grade),
front_overall_from_subgrades: mapGradeValue(result?.laser_front_scan?.overall_from_subgrades),
back_overall_from_subgrades: mapGradeValue(result?.laser_back_scan?.overall_from_subgrades),
front_raw_surface_minor_defect: result?.front_raw_grades?.surface_minor_defect,
front_raw_surface_major_defect: result?.front_raw_grades?.surface_major_defect,
front_raw_edge_minor_defect: result?.front_raw_grades?.edge_minor_defect,
Expand Down Expand Up @@ -318,6 +320,7 @@ export const submitAnnotationFrameToGradeAsync =
[`${input.orientation}_edges_laser_grade`]: mapGradeValue(data?.edge),
[`${input.orientation}_surface_laser_grade`]: mapGradeValue(data?.surface),
[`${input.orientation}_overall_predicted_grade`]: mapGradeValue(data?.overall),
[`${input.orientation}_overall_from_subgrades`]: mapGradeValue(data?.overall_from_subgrades),
[`${input.orientation}_opposite_angle`]: mapGradeValue(data?.angles?.opposite_angle),
[`${input.orientation}_inner_outer_angle`]: mapGradeValue(data?.angles?.inner_outer_angle),
[`${input.orientation}_distance`]: mapGradeValue(data?.angles?.distance),
Expand Down
43 changes: 6 additions & 37 deletions cvat-ui/src/components/annotation-page/grades-form/grades-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export function GradesForm({ task }: Props): JSX.Element | null {
const values = useSelector((state: CombinedState) => state.grades.values);
const [computedHumanFrontTotal, setComputedHumanFrontTotal] = useState(0);
const [computedHumanBackTotal, setComputedHumanBackTotal] = useState(0);
const [computedRobogradesFrontTotal, setComputedRobogradesFrontTotal] = useState(0);
const [computedRobogradesBackTotal, setComputedRobogradesBackTotal] = useState(0);
const [computedRawRobogradesFrontTotal, setComputedRawRobogradesFrontTotal] = useState(0);
const [computedRawRobogradesBackTotal, setComputedRawRobogradesBackTotal] = useState(0);
const [computedLowestTotal, setComputedLowestTotal] = useState(0);
Expand Down Expand Up @@ -165,22 +163,6 @@ export function GradesForm({ task }: Props): JSX.Element | null {
formRef.current?.getFieldValue('back_surface_human_grade'),
]),
);
setComputedRobogradesFrontTotal(
computeTotal([
formRef.current?.getFieldValue('front_centering_laser_grade'),
formRef.current?.getFieldValue('front_edges_laser_grade'),
formRef.current?.getFieldValue('front_corners_laser_grade'),
formRef.current?.getFieldValue('front_surface_laser_grade'),
]),
);
setComputedRobogradesBackTotal(
computeTotal([
formRef.current?.getFieldValue('back_centering_laser_grade'),
formRef.current?.getFieldValue('back_edges_laser_grade'),
formRef.current?.getFieldValue('back_corners_laser_grade'),
formRef.current?.getFieldValue('back_surface_laser_grade'),
]),
);
setComputedRawRobogradesFrontTotal(
computeTotal([
formRef.current?.getFieldValue('front_raw_centering_grade'),
Expand Down Expand Up @@ -259,22 +241,6 @@ export function GradesForm({ task }: Props): JSX.Element | null {
values?.back_surface_human_grade,
]),
);
setComputedRobogradesFrontTotal(
computeTotal([
values?.front_centering_laser_grade,
values?.front_edges_laser_grade,
values?.front_corners_laser_grade,
values?.front_surface_laser_grade,
]),
);
setComputedRobogradesBackTotal(
computeTotal([
values?.back_centering_laser_grade,
values?.back_edges_laser_grade,
values?.back_corners_laser_grade,
values?.back_surface_laser_grade,
]),
);
setComputedRawRobogradesFrontTotal(
computeTotal([
values?.front_raw_centering_grade,
Expand Down Expand Up @@ -353,9 +319,12 @@ export function GradesForm({ task }: Props): JSX.Element | null {
},
{
gradeType: 'Robogrades',
totalFront: computedRobogradesFrontTotal,
totalBack: computedRobogradesBackTotal,
totalOverall: computeTotalOverall(computedRobogradesFrontTotal, computedRobogradesBackTotal),
totalFront: values?.front_overall_from_subgrades,
totalBack: values?.back_overall_from_subgrades,
totalOverall: computeTotalOverall(
values?.front_overall_from_subgrades,
values?.back_overall_from_subgrades,
),
},
{
gradeType: 'Raw Robogrades',
Expand Down
2 changes: 2 additions & 0 deletions cvat-ui/src/reducers/grades-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const defaultState: GradesState = {
back_surface_laser_grade: 0,
front_overall_predicted_grade: 0,
back_overall_predicted_grade: 0,
front_overall_from_subgrades: 0,
back_overall_from_subgrades: 0,
front_raw_surface_minor_defect: [0, 0],
front_raw_surface_major_defect: [0, 0],
front_raw_edge_minor_defect: [0, 0],
Expand Down
2 changes: 2 additions & 0 deletions cvat-ui/src/reducers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ export interface GradesState {
back_surface_laser_grade: number;
front_overall_predicted_grade: number;
back_overall_predicted_grade: number;
front_overall_from_subgrades: number;
back_overall_from_subgrades: number;
front_raw_surface_minor_defect: number[];
front_raw_surface_major_defect: number[];
front_raw_edge_minor_defect: number[];
Expand Down

0 comments on commit 24b36df

Please sign in to comment.