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

Commitd4b4dae

Browse files
authored
Merge pull requestcoderoad#409 from coderoad/fix/subtasks
revert subtask error check code
2 parents8db3798 +364f5e1 commitd4b4dae

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

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

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,29 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
4545
status='ACTIVE'
4646
}
4747
if(step.subtasks&&step.subtasks){
48-
if(Object.keys(testStatus?.summary||{}).length!==step.subtasks.length){
48+
consttestSummaries=Object.keys(testStatus?.summary||{})
49+
if(testSummaries.length&&testSummaries.length!==step.subtasks.length){
4950
// test result count and subtask count don't match
5051
// something is wrong with the tutorial
5152
// 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-
})
53+
console.error(
54+
'ERROR: subtasks and test results have a different number of results. This is likely an error with the tutorial or an edited test file.',
55+
)
7456
}
57+
subtasks=step.subtasks.map((subtask:string,subtaskIndex:number)=>{
58+
letsubtaskStatus:T.ProgressStatus='INCOMPLETE'
59+
// task is complete, subtasks must be complete
60+
if(status==='COMPLETE'){
61+
subtaskStatus='COMPLETE'
62+
// task is active, check which are complete from test results
63+
}elseif(status==='ACTIVE'){
64+
subtaskStatus=!!(testStatus?.summary&&testStatus.summary[subtaskIndex]) ?'COMPLETE' :'ACTIVE'
65+
}
66+
return{
67+
name:subtask,
68+
status:subtaskStatus,
69+
}
70+
})
7571
}
7672
return{ ...step, status, subtasks}
7773
}),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp