Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite152719

Browse files
committed
fix continue progress
1 parent54545e4 commite152719

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

‎src/channel/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ class Channel implements Channel {
144144
constactionType:string=typeofaction==='string' ?action :action.type
145145
switch(actionType){
146146
case'TEST_PASS':
147-
// update local storage stepProgress
148-
constprogress=this.context.progress.setStepComplete(action.payload.stepId)
149147
consttutorial=this.context.tutorial.get()
150148
if(!tutorial){
151149
thrownewError('Error with current tutorial')
152150
}
151+
// update local storage stepProgress
152+
constprogress=this.context.progress.setStepComplete(tutorial.version.data,action.payload.stepId)
153153
this.context.position.setPositionFromProgress(tutorial,progress)
154154
saveCommit()
155155
}

‎src/channel/state/Position.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ class Position {
3333
thrownewError('Error setting position from progress')
3434
}
3535

36+
// get level
3637
const{ levels}=tutorial.version.data
37-
3838
constlastLevelIndex:number|undefined=levels.findIndex((l:G.Level)=>!progress.levels[l.id])
39-
4039
if(lastLevelIndex>=levels.length){
4140
thrownewError('Error setting progress level')
4241
}
43-
constcurrentLevel:G.Level=levels[lastLevelIndex]
4442

43+
// get step
44+
constcurrentLevel:G.Level=levels[lastLevelIndex]
4545
const{ steps}=currentLevel
46-
4746
constlastStepIndex:number|undefined=steps.findIndex((s:G.Step)=>!progress.steps[s.id])
4847
if(lastStepIndex>=steps.length){
4948
thrownewError('Error setting progress step')

‎src/channel/state/Progress.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,25 @@ class Progress {
3939
publicreset=()=>{
4040
this.set(defaultValue)
4141
}
42-
publicsetStepComplete=(stepId:string):CR.Progress=>{
42+
publicsetStepComplete=(tutorialData:G.TutorialData,stepId:string):CR.Progress=>{
4343
constnext=this.value
44+
// mark step complete
4445
next.steps[stepId]=true
4546

46-
// TODO validate if progress is complete for a level or tutorial
47+
constcurrentLevel=tutorialData.levels.find(l=>l.steps.find(s=>s.id===stepId))
48+
if(!currentLevel){
49+
thrownewError(`setStepComplete level not found for stepId${stepId}`)
50+
}
51+
52+
if(currentLevel.steps[currentLevel.steps.length-1]){
53+
// final step for level is complete
54+
next.levels[currentLevel.id]=true
55+
56+
if(tutorialData.levels[tutorialData.levels.length-1].id===currentLevel.id){
57+
//final level complete so tutorial is complete
58+
next.complete=true
59+
}
60+
}
4761

4862
returnthis.set(next)
4963
}

‎src/editor/commands.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import*asTfrom'typings'
22
import*asvscodefrom'vscode'
3-
importnotifyfrom'../services/notify'
43
importcreateTestRunner,{Payload}from'../services/testRunner'
54
importcreateWebViewfrom'../webview'
65

@@ -27,9 +26,6 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }:
2726
return{
2827
// initialize
2928
[COMMANDS.START]:async()=>{
30-
// TODO replace with a prompt to open a workspace
31-
// await isEmptyWorkspace()
32-
3329
letwebviewState:'INITIALIZING'|'RESTARTING'
3430
if(!webview){
3531
webviewState='INITIALIZING'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp