Skip to content

Commit

Permalink
Text exercises: Fix an edge case with discarded Athena feedback sugge…
Browse files Browse the repository at this point in the history
…stions for tutors (#10140)
  • Loading branch information
maximiliansoelch authored Jan 15, 2025
1 parent e0cda16 commit 247e7fb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ export class TextSubmissionAssessmentComponent extends TextAssessmentBaseCompone
// ("squish" the existing text block)
existingBlockRef.block!.startIndex = end;
newTextBlockRefs.push(existingBlockRef);
} else if (exEnd == end) {
// existing: |-----|
// to add: |----------|
// -> |-add--|ex-|
// ("squish" the new text block)
refToAdd.block!.endIndex = exStart;
newTextBlockRefs.push(existingBlockRef);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,28 @@ describe('TextSubmissionAssessmentComponent', () => {
[10, 15],
],
},
// Two blocks, same end index
{
input: [
[377, 719],
[453, 719],
],
output: [
[377, 453],
[453, 719],
],
},
// Two blocks, same end index, wrong order
{
input: [
[453, 719],
[377, 719],
],
output: [
[377, 453],
[453, 719],
],
},
// Two blocks, shifted
{
input: [
Expand Down

0 comments on commit 247e7fb

Please sign in to comment.