Skip to content

Commit

Permalink
Task review app - Fixed worker picking order during review
Browse files Browse the repository at this point in the history
  • Loading branch information
meta-paul committed Sep 27, 2023
1 parent 75bf0e3 commit c9489d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion mephisto/client/review_app/client/src/requests/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions mephisto/client/review_app/server/api/views/units_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c9489d9

Please sign in to comment.