Skip to content

Feature/remove progress #414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 1, 2020
Prev Previous commit
Next Next commit
load to exact point on continue
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 31, 2020
commit 16accb533e863a8fbd5fdc8c5c5b2fe3bccbcda7
14 changes: 11 additions & 3 deletions web-app/src/services/state/actions/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,18 @@ export const clearError = assign({
})

export const checkLevelCompleted = send((context: T.MachineContext) => {
// no step id indicates no steps to complete
logger(context.position)
const currentLevel = selectors.currentLevel(context)
let hasNoSteps = false
let finalStepComplete = false
if (!currentLevel.steps.length) {
hasNoSteps = true
} else {
const finalStep = currentLevel.steps[currentLevel.steps.length - 1]
finalStepComplete = finalStep.id === context.position.stepId && context.position.complete
}

return {
type: context.position.stepId === null ? 'START_COMPLETED_LEVEL' : 'START_LEVEL',
type: hasNoSteps || finalStepComplete ? 'START_COMPLETED_LEVEL' : 'START_LEVEL',
}
})

Expand Down
2 changes: 1 addition & 1 deletion web-app/src/services/state/actions/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default (editorSend: any) => ({
editorSend({
type: 'EDITOR_SYNC_POSITION',
payload: {
position: { ...context.position, complete: true },
position: context.position,
},
})
},
Expand Down