Skip to content

Commit

Permalink
Merge pull request #782 from digirati-co-uk/NS-31/hotfix/max-contribu…
Browse files Browse the repository at this point in the history
…tors-fix

check if max contributors includes current user
  • Loading branch information
Heather0K committed Aug 7, 2023
2 parents d7fd161 + 4fc491f commit 3809283
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ export function useCanvasUserTasks() {
const completedAndHide = !config.project.allowSubmissionsWhenCanvasComplete && canvasTask?.canvasTask?.status === 3;
const completed = canvasTask?.canvasTask?.status === 3;

const maxContributorsReached =
const maxContributors =
canvasTask?.maxContributors && canvasTask.totalContributors
? canvasTask.maxContributors <= canvasTask.totalContributors
? canvasTask.maxContributors >= canvasTask.totalContributors
: false;

// if max contributors reached check that the current user isnt one of them
const maxContributorsReached = maxContributors ? !userTasks?.some(t => t.type === 'crowdsourcing-task') : false;

const canClaimCanvas =
user && (config.project.claimGranularity ? config.project.claimGranularity === 'canvas' : true);
const canUserSubmit = user && !!canvasTask?.canUserSubmit;
Expand Down
2 changes: 1 addition & 1 deletion services/madoc-ts/src/utility/claim-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function canUserClaimCanvas(options: {
const users: string[] = [];
for (const task of subtasks) {
if (task.assignee) {
if (!users.includes(task.assignee.id)) {
if (task.assignee.id !== `urn:madoc:user:${options.userId}` && !users.includes(task.assignee.id)) {
users.push(task.assignee.id);
}
}
Expand Down

0 comments on commit 3809283

Please sign in to comment.