@@ -78,23 +78,31 @@ export default {
7878console . log ( 'ACTION: tutorialLoad.progress' )
7979return currentProgress
8080} ,
81- position ( ) {
81+ position ( context : any ) : CR . Position {
8282console . log ( 'ACTION: tutorialLoad.position' )
8383if ( ! currentTutorial ) {
8484throw new Error ( 'No Tutorial loaded' )
8585}
8686const { 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+ }
9199
92100const position = {
93101 levelId,
94102 stageId,
95- stepId,
103+ stepId
96104}
97-
105+ console . log ( 'position' , position )
98106return position
99107}
100108} ) ,