From c9489d91764faf5017695676b7197c251fc5c1ba Mon Sep 17 00:00:00 2001 From: Paul Abumov Date: Wed, 27 Sep 2023 16:38:06 -0400 Subject: [PATCH] Task review app - Fixed worker picking order during review --- .../webapp/src/components/core_components.jsx | 4 ++-- .../client/review_app/client/src/pages/TaskPage/TaskPage.tsx | 4 ++-- mephisto/client/review_app/client/src/requests/units.ts | 3 ++- mephisto/client/review_app/server/api/views/units_view.py | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/remote_procedure/mnist_for_review/webapp/src/components/core_components.jsx b/examples/remote_procedure/mnist_for_review/webapp/src/components/core_components.jsx index 764b2733c..6e79a9fa0 100644 --- a/examples/remote_procedure/mnist_for_review/webapp/src/components/core_components.jsx +++ b/examples/remote_procedure/mnist_for_review/webapp/src/components/core_components.jsx @@ -152,14 +152,14 @@ function TaskFrontend({ const [annotations, updateAnnotations] = React.useReducer( (currentAnnotation, { updateIdx, updatedAnnotation }) => { return currentAnnotation.map((val, idx) => - idx == updateIdx ? updatedAnnotation : val + idx == updateIdx ? updatedAnnotation : val, ); }, Array(NUM_ANNOTATIONS).fill({ currentAnnotation: null, trueAnnotation: null, isCorrect: null, - }) + }), ); let canSubmit = annotations.filter((a) => a.isCorrect === true || a.trueAnnotation !== "") diff --git a/mephisto/client/review_app/client/src/pages/TaskPage/TaskPage.tsx b/mephisto/client/review_app/client/src/pages/TaskPage/TaskPage.tsx index 97397a8fc..8acd6a1cc 100644 --- a/mephisto/client/review_app/client/src/pages/TaskPage/TaskPage.tsx +++ b/mephisto/client/review_app/client/src/pages/TaskPage/TaskPage.tsx @@ -119,9 +119,9 @@ function TaskPage(props: PropsType) { sortedValue.push([Number(i), workerUnitsMap[i]]); } - // Sort workers by number of their units + // Sort workers by number of their units (the fewest number of units goes first) sortedValue.sort((a: [number, number[]], b: [number, number[]]) => { - return a[1].length < b[1].length ? 1 : -1; + return a[1].length > b[1].length ? 1 : -1; }); return sortedValue; diff --git a/mephisto/client/review_app/client/src/requests/units.ts b/mephisto/client/review_app/client/src/requests/units.ts index cf13283b7..254b8d049 100644 --- a/mephisto/client/review_app/client/src/requests/units.ts +++ b/mephisto/client/review_app/client/src/requests/units.ts @@ -12,7 +12,8 @@ export function getUnits( setDataAction: SetRequestDataActionType, setLoadingAction: SetRequestLoadingActionType, setErrorsAction: SetRequestErrorsActionType, - getParams: { [key: string]: string | number } = null + getParams: { [key: string]: string | number } = null, + abortController?: AbortController ) { const url = generateURL(urls.server.units, null, getParams); diff --git a/mephisto/client/review_app/server/api/views/units_view.py b/mephisto/client/review_app/server/api/views/units_view.py index 64c75ebd3..30511aeaa 100644 --- a/mephisto/client/review_app/server/api/views/units_view.py +++ b/mephisto/client/review_app/server/api/views/units_view.py @@ -78,8 +78,8 @@ def get(self) -> dict: "results": { "start": unit_data.get("task_start"), "end": unit_data.get("task_end"), - "input_preview": None, # optional TODO [Review APP] - "output_preview": None, # optional TODO [Review APP] + "inputs_preview": None, # optional TODO [Review APP] + "outputs_preview": None, # optional TODO [Review APP] }, "review": { "tips": int(tips) if tips else None,