Skip to content

Commit 89795db

Browse files
committed
fix return from tutorial completed
Signed-off-by: shmck <[email protected]>
1 parent 3523007 commit 89795db

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

web-app/src/containers/Tutorial/formatLevels.ts

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
3737
stepIndex = levels[levelIndex].steps.length
3838
}
3939

40+
// current level
4041
const levelUI: T.LevelUI = {
4142
...currentLevel,
4243
status: progress.levels[position.levelId] ? 'COMPLETE' : 'ACTIVE',
@@ -80,6 +81,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
8081
}),
8182
}
8283

84+
// flag all levels before as complete
8385
const completed: T.LevelUI[] = levels.slice(0, levelIndex).map((level: TT.Level) => ({
8486
...level,
8587
status: 'COMPLETE',
@@ -90,6 +92,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
9092
})),
9193
}))
9294

95+
// flag all levels after as incomplete
9396
const incompleted: T.LevelUI[] = levels.slice(levelIndex + 1, levels.length).map((level: TT.Level) => ({
9497
...level,
9598
status: 'INCOMPLETE',

web-app/src/services/state/machine.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ export const createMachine = (options: any) => {
141141
Tutorial: {
142142
id: 'tutorial',
143143
initial: 'Level',
144+
on: {
145+
RUN_RESET_TO_POSITION: {
146+
actions: ['runResetToPosition'],
147+
target: 'Tutorial.Level',
148+
},
149+
},
144150
states: {
145151
Level: {
146152
initial: 'Load',
@@ -171,9 +177,6 @@ export const createMachine = (options: any) => {
171177
RUN_RESET: {
172178
actions: ['runReset'],
173179
},
174-
RUN_RESET_TO_POSITION: {
175-
actions: ['runResetToPosition'],
176-
},
177180
KEY_PRESS_ENTER: {
178181
actions: ['runTest'],
179182
},

0 commit comments

Comments
 (0)