Open spsither opened 6 months ago
Observation: After every 10th task, the app slows down when assigning a new task.
we can run getTasksOrAssignMore
as an async job like this when a user has ~5 tasks left.
Possible race conditions in assignUnassignedTasks. Transactions might be required here.
When there is only one reviewer in a group, we can assign all the submitted
tasks to that one reviewer.
select * from "User" u join "Group" g ON g.id = u.group_id where g."name" = 'stt_tt_ga' and u."role" = 'REVIEWER';
select count(*) from "Task" t where t.group_id = 11 and t."state" = 'submitted' and t.reviewer_id is null;
select count(*) from "Task" t where t.group_id = 11 and t."state" = 'submitted' and t.reviewer_id = 63;
-- update "Task" t set reviewer_id = 63 where t.group_id = 11 and t."state" = 'submitted' and t.reviewer_id is null;
select * from "User" u join "Group" g ON g.id = u.group_id where g."name" = 'prodigy' and u."role" = 'REVIEWER';
select count(*) from "Task" t where t.group_id = 17 and t."state" = 'submitted' and t.reviewer_id is null;
select count(*) from "Task" t where t.group_id = 17 and t."state" = 'submitted' and t.reviewer_id = 47;
-- update "Task" t set reviewer_id = 47 where t.group_id = 17 and t."state" = 'submitted' and t.reviewer_id is null;
assignTasks
When assigning Task, we only need to select for Task ids to update the Task.
https://github.com/OpenPecha/pecha-tools-for-stt/blob/da6cd9bb381f0840f42bce777fbb26365047a0f4/src/model/action.js#L145
We don't need to include the transcriber here https://github.com/OpenPecha/pecha-tools-for-stt/blob/da6cd9bb381f0840f42bce777fbb26365047a0f4/src/model/action.js#L193
getAssignedTasks
Include is needed here but we only need the transcriber name and not the whole transcriber. no? https://github.com/OpenPecha/pecha-tools-for-stt/blob/da6cd9bb381f0840f42bce777fbb26365047a0f4/src/model/action.js#L83