Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Oct 28, 2024
1 parent e94614e commit fdbc53b
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 119 deletions.
17 changes: 12 additions & 5 deletions src/components/HOCs/WithTaskBundle/WithTaskBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ export function WithTaskBundle(WrappedComponent) {
}
}

unlockTasks = async (initialBundle, taskBundle) => {
const tasksToUnlock = initialBundle.taskIds.filter(taskId => !taskBundle.taskIds.includes(taskId))
unlockTasks = async (taskBundle,initialBundle) => {
const tasksToUnlock = taskBundle.taskIds
if(initialBundle){
tasksToUnlock.filter(taskId => !initialBundle.taskIds.includes(taskId))
}
await Promise.all(tasksToUnlock.map(taskId =>
this.props.releaseTask(taskId).then(() => {
setTimeout(() => localStorage.removeItem(`lock-${taskId}`), 1500)
Expand All @@ -116,6 +119,8 @@ export function WithTaskBundle(WrappedComponent) {
return task.entities.tasks[taskId]
} catch (error) {
console.error(`Failed to lock task ${taskId}:`, error)
dispatch(addError(`Failed to lock task ${taskId}:`, error))
dispatch(addError(AppErrors.challenge.rebuildFailure));
throw error
}
}
Expand Down Expand Up @@ -161,9 +166,11 @@ export function WithTaskBundle(WrappedComponent) {
this.setState({ taskBundle: updatedTaskBundle })
}

clearActiveTaskBundle = () => {
this.setState({
selectedTasks: [],
clearActiveTaskBundle = async () => {
const { taskBundle, initialBundle } = this.state
await this.unlockTasks(taskBundle, initialBundle)
this.setState({
selectedTasks: [],
taskBundle: null,
})
this.resetSelectedTasks()
Expand Down
Loading

0 comments on commit fdbc53b

Please sign in to comment.