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

fix continue progress#153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfix/continue-progress
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionssrc/channel/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,12 +144,12 @@ class Channel implements Channel {
constactionType:string=typeofaction==='string' ?action :action.type
switch(actionType){
case'TEST_PASS':
// update local storage stepProgress
constprogress=this.context.progress.setStepComplete(action.payload.stepId)
consttutorial=this.context.tutorial.get()
if(!tutorial){
thrownewError('Error with current tutorial')
}
// update local storage stepProgress
constprogress=this.context.progress.setStepComplete(tutorial.version.data,action.payload.stepId)
this.context.position.setPositionFromProgress(tutorial,progress)
saveCommit()
}
Expand Down
7 changes: 3 additions & 4 deletionssrc/channel/state/Position.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,17 +33,16 @@ class Position {
throw new Error('Error setting position from progress')
}

// get level
const { levels } = tutorial.version.data

const lastLevelIndex: number | undefined = levels.findIndex((l: G.Level) => !progress.levels[l.id])

if (lastLevelIndex >= levels.length) {
throw new Error('Error setting progress level')
}
const currentLevel: G.Level = levels[lastLevelIndex]

// get step
const currentLevel: G.Level = levels[lastLevelIndex]
const { steps } = currentLevel

const lastStepIndex: number | undefined = steps.findIndex((s: G.Step) => !progress.steps[s.id])
if (lastStepIndex >= steps.length) {
throw new Error('Error setting progress step')
Expand Down
18 changes: 16 additions & 2 deletionssrc/channel/state/Progress.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,11 +39,25 @@ class Progress {
publicreset=()=>{
this.set(defaultValue)
}
publicsetStepComplete=(stepId:string):CR.Progress=>{
publicsetStepComplete=(tutorialData:G.TutorialData,stepId:string):CR.Progress=>{
constnext=this.value
// mark step complete
next.steps[stepId]=true

// TODO validate if progress is complete for a level or tutorial
constcurrentLevel=tutorialData.levels.find(l=>l.steps.find(s=>s.id===stepId))
if(!currentLevel){
thrownewError(`setStepComplete level not found for stepId${stepId}`)
}

if(currentLevel.steps[currentLevel.steps.length-1]){
// final step for level is complete
next.levels[currentLevel.id]=true

if(tutorialData.levels[tutorialData.levels.length-1].id===currentLevel.id){
//final level complete so tutorial is complete
next.complete=true
}
}

returnthis.set(next)
}
Expand Down
4 changes: 0 additions & 4 deletionssrc/editor/commands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
import * as T from 'typings'
import * as vscode from 'vscode'
import notify from '../services/notify'
import createTestRunner, { Payload } from '../services/testRunner'
import createWebView from '../webview'

Expand All@@ -27,9 +26,6 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }:
return {
// initialize
[COMMANDS.START]: async () => {
// TODO replace with a prompt to open a workspace
// await isEmptyWorkspace()

let webviewState: 'INITIALIZING' | 'RESTARTING'
if (!webview) {
webviewState = 'INITIALIZING'
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp