@@ -13,18 +13,25 @@ class Position {
1313 this . value = defaultValue
1414 }
1515 public get = ( ) => {
16+ if ( ! this . value . levelId || ! this . value . stepId ) {
17+ console . log ( 'NO POSITION RETURNED' )
18+ }
19+ console . log ( this . value )
1620 return this . value
1721 }
1822 public set = ( value : CR . Position ) => {
23+ console . log ( '--- position set' )
24+ console . log ( value )
1925 this . value = value
2026 }
2127 public reset = ( ) => {
2228 this . value = defaultValue
2329 }
2430 // calculate the current position based on the saved progress
2531 public setPositionFromProgress = ( tutorial : G . Tutorial , progress : CR . Progress ) : CR . Position => {
32+ console . log ( '--- set position from progress' )
2633 // tutorial already completed
27- // TODO: handle start again?
34+ // TODO handle start again?
2835 if ( progress . complete ) {
2936 return this . value
3037 }
@@ -36,7 +43,7 @@ class Position {
3643 const { levels } = tutorial . version . data
3744
3845 const lastLevelIndex : number | undefined = levels . findIndex ( ( l : G . Level ) => ! progress . levels [ l . id ] )
39- // TODO: consider all levels complete as progress.complete
46+ // TODO consider all levels complete as progress.complete
4047 if ( lastLevelIndex >= levels . length ) {
4148 throw new Error ( 'Error setting progress level' )
4249 }
@@ -56,6 +63,9 @@ class Position {
5663 levelId : currentLevel . id ,
5764 stepId : currentStep . id ,
5865 }
66+
67+ console . log ( '--- calculated set position from progress' )
68+ console . log ( this . value )
5969 return this . value
6070 }
6171}
0 commit comments