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

Commit6759ce7

Browse files
committed
fixes for progress recording
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent369bd90 commit6759ce7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

‎web-app/src/containers/Tutorial/formatLevels.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,24 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
3232

3333
const currentLevel = levels[levelIndex]
3434

35+
let stepIndex = currentLevel.steps.findIndex((s: TT.Step) => s.id === position.stepId)
36+
if (stepIndex === -1) {
37+
stepIndex = levels[levelIndex].steps.length
38+
}
39+
3540
const levelUI: T.LevelUI = {
3641
...currentLevel,
3742
status: progress.levels[position.levelId] ? 'COMPLETE' : 'ACTIVE',
38-
steps: currentLevel.steps.map((step: TT.Step) => {
43+
steps: currentLevel.steps.map((step: TT.Step, index) => {
3944
// label step status for step component
4045
let status: T.ProgressStatus = 'INCOMPLETE'
4146
let subtasks
42-
if (progress.steps[step.id]) {
47+
if (index < stepIndex || (index === stepIndex &&progress.steps[step.id])) {
4348
status = 'COMPLETE'
44-
} else if (step.id ===position.stepId) {
49+
} else if (index ===stepIndex) {
4550
status = 'ACTIVE'
51+
} else {
52+
status = 'INCOMPLETE'
4653
}
4754
if (step.subtasks && step.subtasks) {
4855
const testSummaries = Object.keys(testStatus?.summary || {})
@@ -95,10 +102,6 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
95102

96103
const levelsUI: T.LevelUI[] = [...completed, levelUI, ...incompleted]
97104

98-
let stepIndex = levelUI.steps.findIndex((s: T.StepUI) => s.status === 'ACTIVE')
99-
if (stepIndex === -1) {
100-
stepIndex = levels[levelIndex].steps.length
101-
}
102105
return { level: levelUI, levels: levelsUI, levelIndex, stepIndex }
103106
}
104107

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp