Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 336aaf7

Browse files
committed
Fix more distractor-related grading bugs
1 parent f9414ba commit 336aaf7

2 files changed

Lines changed: 5 additions & 14 deletions

File tree

runestone/parsons/js/dagGrader.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,17 @@ function allSubsets(arr) {
4747

4848
export default class DAGGrader extends LineBasedGrader {
4949

50-
inverseLISIndices(arr) {
50+
inverseLISIndices(arr, inSolution) {
5151
// For more details and a proof of the correctness of the algorithm, see the paper: https://arxiv.org/abs/2204.04196
5252

5353
var solution = this.problem.solution;
54-
var answerLines = this.problem.answerLines();
54+
var answerLines = inSolution.map(block => block.lines[0]); // assume NOT adaptive for DAG grading (for now)
5555

5656
let graph = graphToNX(solution);
5757

5858
let seen = new Set();
5959
let problematicSubgraph = new DiGraph();
60-
let indices = [];
61-
for (let i = 0; i < answerLines.length; i++) {
62-
let line1 = answerLines[i];
63-
64-
if (line1.distractor) {
65-
indices.push(i);
66-
continue;
67-
}
68-
60+
for (let line1 of answerLines) {
6961
for (let line2 of seen) {
7062
let problematic = hasPath(graph, {source: line1.tag, target: line2.tag});
7163
if (problematic) {
@@ -90,12 +82,11 @@ export default class DAGGrader extends LineBasedGrader {
9082
}
9183
}
9284

93-
indices = indices.concat([...mvc].map(tag => {
85+
let indices = ([...mvc].map(tag => {
9486
for (let i = 0; i < answerLines.length; i++) {
9587
if (answerLines[i].tag === tag) return i;
9688
}
9789
}));
98-
9990
return indices;
10091
}
10192

runestone/parsons/js/parsons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ export default class Parsons extends RunestoneBase {
14241424
inSolutionIndexes.push(index);
14251425
}
14261426
}
1427-
var lisIndexes = this.grader.inverseLISIndices(inSolutionIndexes);
1427+
var lisIndexes = this.grader.inverseLISIndices(inSolutionIndexes, inSolution);
14281428
for (let i = 0; i < lisIndexes.length; i++) {
14291429
notInSolution.push(inSolution[lisIndexes[i]]);
14301430
}

0 commit comments

Comments
 (0)