Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3fe5b80

Browse files
committed
log tutorial and continue position
Signed-off-by: shmck <[email protected]>
1 parent 9d433af commit 3fe5b80

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/actions/onStartup.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Context from '../services/context/context'
55
import { send } from '../commands'
66
import { WORKSPACE_ROOT, TUTORIAL_URL } from '../environment'
77
import fetch from 'node-fetch'
8+
import logger from '../services/logger'
89

910
const onStartup = async (context: Context): Promise<void> => {
1011
try {
@@ -36,10 +37,12 @@ const onStartup = async (context: Context): Promise<void> => {
3637
// NEW: no stored tutorial, must start new tutorial
3738
if (!tutorial || !tutorial.version) {
3839
if (TUTORIAL_URL) {
40+
logger(`Using tutorial url from env: ${TUTORIAL_URL}`)
3941
// if a tutorial URL is added, launch on startup
4042
try {
4143
const tutorialRes = await fetch(TUTORIAL_URL)
42-
const tutorial = await tutorialRes.json()
44+
const tutorial: TT.Tutorial = await tutorialRes.json()
45+
logger(`Tutorial: ${tutorial?.summary?.title} (${tutorial?.version})`)
4346
send({ type: 'START_TUTORIAL_FROM_URL', payload: { tutorial } })
4447
return
4548
} catch (e: any) {
@@ -54,6 +57,7 @@ const onStartup = async (context: Context): Promise<void> => {
5457

5558
// CONTINUE_FROM_PROGRESS
5659
const { position } = await context.onContinue(tutorial)
60+
logger(`Continuing tutorial from progress: level ${position?.levelId} step ${position?.stepId}`)
5761
// communicate to client the tutorial & stepProgress state
5862
send({ type: 'LOAD_STORED_TUTORIAL', payload: { env, tutorial, position } })
5963
} catch (e: any) {

src/actions/onTutorialConfigContinue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import logger from '../services/logger'
88
import { setupWebhook } from '../services/hooks/webhooks'
99

1010
const onTutorialConfigContinue = async (action: T.Action, context: Context): Promise<void> => {
11-
logger(`Continuing tutorial from progress: ${JSON.stringify(action.payload)}`)
1211
try {
1312
const tutorialToContinue: TT.Tutorial | null = context.tutorial.get()
13+
logger(`Tutorial: ${tutorialToContinue?.summary?.title} (${tutorialToContinue?.version})`)
1414
if (!tutorialToContinue) {
1515
throw new Error('Invalid tutorial to continue')
1616
}

0 commit comments

Comments
 (0)