@@ -78,23 +78,31 @@ export default {
78
78
console.log('ACTION: tutorialLoad.progress')
79
79
return currentProgress
80
80
},
81
- position() {
81
+ position(context: any): CR.Position {
82
82
console.log('ACTION: tutorialLoad.position')
83
83
if (!currentTutorial) {
84
84
throw new Error('No Tutorial loaded')
85
85
}
86
86
const { data } = currentTutorial
87
-
88
- const levelId = data.summary.levelList[0]
89
- const stageId = data.levels[levelId].stageList[0]
90
- const stepId = data.stages[stageId].stepList[0]
87
+ const levelId = data.summary.levelList.find((id: string) => !currentProgress.levels[id])
88
+ if (!levelId) {
89
+ throw new Error('No level found on position load')
90
+ }
91
+ const stageId = data.levels[levelId].stageList.find((id: string) => !currentProgress.stages[id])
92
+ if (!stageId) {
93
+ throw new Error('No stage found on position load')
94
+ }
95
+ const stepId = data.stages[stageId].stepList.find((id: string) => !currentProgress.steps[id])
96
+ if (!stepId) {
97
+ throw new Error('No step found on position load')
98
+ }
91
99
92
100
const position = {
93
101
levelId,
94
102
stageId,
95
- stepId,
103
+ stepId
96
104
}
97
-
105
+ console.log('position', position)
98
106
return position
99
107
}
100
108
}),