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

Commitb682318

Browse files
committed
show error message if issue with subtasks
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent7b995fc commitb682318

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

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

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,33 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
4545
status='ACTIVE'
4646
}
4747
if(step.subtasks&&step.subtasks){
48-
subtasks=step.subtasks.map((subtask:string,subtaskIndex:number)=>{
49-
letsubtaskStatus:T.ProgressStatus='INCOMPLETE'
50-
// task is complete, subtasks must be complete
51-
if(status==='COMPLETE'){
52-
subtaskStatus='COMPLETE'
53-
// task is active, check which are complete from test results
54-
}elseif(status==='ACTIVE'){
55-
subtaskStatus=!!(testStatus?.summary&&testStatus.summary[subtaskIndex]) ?'COMPLETE' :'ACTIVE'
56-
}
57-
return{
58-
name:subtask,
59-
status:subtaskStatus,
60-
}
61-
})
48+
if(Object.keys(testStatus?.summary||{}).length!==step.subtasks.length){
49+
// test result count and subtask count don't match
50+
// something is wrong with the tutorial
51+
// NOTE: hacky temp solution as should be caught by tutorial creators / build tools
52+
subtasks=[
53+
{
54+
name:
55+
'ERROR: subtasks and test results have a different number of results. This is likely an error with the tutorial.',
56+
status:'ACTIVE'as'ACTIVE',
57+
},
58+
]
59+
}else{
60+
subtasks=step.subtasks.map((subtask:string,subtaskIndex:number)=>{
61+
letsubtaskStatus:T.ProgressStatus='INCOMPLETE'
62+
// task is complete, subtasks must be complete
63+
if(status==='COMPLETE'){
64+
subtaskStatus='COMPLETE'
65+
// task is active, check which are complete from test results
66+
}elseif(status==='ACTIVE'){
67+
subtaskStatus=!!(testStatus?.summary&&testStatus.summary[subtaskIndex]) ?'COMPLETE' :'ACTIVE'
68+
}
69+
return{
70+
name:subtask,
71+
status:subtaskStatus,
72+
}
73+
})
74+
}
6275
}
6376
return{ ...step, status, subtasks}
6477
}),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp