Skip to content

Commit

Permalink
Be very certain tasks are completed before showing modal (#7408)
Browse files Browse the repository at this point in the history
* Be very certain tasks are completed before showing modal

* Guard further
iHiD authored Jan 29, 2025
1 parent 906da20 commit 77501d3
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export function processTasks(
return {
updatedTasks: [],
numberOfCompletedTasks: 0,
areAllTasksCompleted: true,
areAllTasksCompleted: false,
activeTaskIndex: 0,
}
}
@@ -33,8 +33,13 @@ export function processTasks(
continue
}

// always set the task to completed if all tests are passing
if (task.tests.every((test) => passingTests.has(test.name))) {
// Always set the task to completed if all tests are passing.
// Unless there are no tests, in which case we're in a weird state,
// but we shouldn't mark the whole thing as passing.
if (
task.tests.length > 0 &&
task.tests.every((test) => passingTests.has(test.name))
) {
updatedTasks.push({ ...task, status: 'completed' })
numberOfCompletedTasks++
continue
@@ -58,7 +63,10 @@ export function processTasks(
updatedTasks.push(task)
}

const areAllTasksCompleted = numberOfCompletedTasks === updatedTasks.length
// Ensure that we have **some** completed tasks to mark this as true.
// A lack of completed tasks should not mark the whole thing as completed.
const areAllTasksCompleted =
numberOfCompletedTasks > 0 && numberOfCompletedTasks === updatedTasks.length

return {
updatedTasks,

0 comments on commit 77501d3

Please sign in to comment.