@@ -57,11 +57,12 @@ export default class DAGGrader extends LineBasedGrader {
5757
5858 let seen = new Set ( ) ;
5959 let problematicSubgraph = new DiGraph ( ) ;
60- let tagsToRemove = [ ] ;
61- for ( let line1 of answerLines ) {
60+ let indices = [ ] ;
61+ for ( let i = 0 ; i < answerLines . length ; i ++ ) {
62+ let line1 = answerLines [ i ] ;
6263
6364 if ( line1 . distractor ) {
64- tagsToRemove . push ( line1 . tag ) ;
65+ indices . push ( i ) ;
6566 continue ;
6667 }
6768
@@ -89,12 +90,11 @@ export default class DAGGrader extends LineBasedGrader {
8990 }
9091 }
9192
92- tagsToRemove = tagsToRemove . concat ( [ ...mvc ] ) ;
93- let indices = tagsToRemove . map ( tag => {
93+ indices = indices . concat ( [ ...mvc ] . map ( tag => {
9494 for ( let i = 0 ; i < answerLines . length ; i ++ ) {
9595 if ( answerLines [ i ] . tag === tag ) return i ;
9696 }
97- } ) ;
97+ } ) ) ;
9898
9999 return indices ;
100100 }
@@ -111,9 +111,13 @@ export default class DAGGrader extends LineBasedGrader {
111111 let loopLimit = Math . min ( solutionLines . length , answerLines . length ) ;
112112 for ( let i = 0 ; i < loopLimit ; i ++ ) {
113113 let line = answerLines [ i ] ;
114- for ( let j = 0 ; j < line . depends . length ; j ++ ) {
115- if ( ! seen . has ( line . depends [ j ] ) ) {
116- isCorrectOrder = false ;
114+ if ( line . distractor ) {
115+ isCorrectOrder = false ;
116+ } else {
117+ for ( let j = 0 ; j < line . depends . length ; j ++ ) {
118+ if ( ! seen . has ( line . depends [ j ] ) ) {
119+ isCorrectOrder = false ;
120+ }
117121 }
118122 }
119123 if ( isCorrectOrder ) {
0 commit comments