Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assessment: Fix the loss of submission text due to overlapping manual text blocks #6916

Merged
merged 13 commits into from
Jul 21, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,19 @@ export abstract class TextAssessmentBaseComponent implements OnInit {
} else if ([ref, previousRef].every((r) => r.block?.type === TextBlockType.AUTOMATIC)) {
console.error('Overlapping AUTOMATIC Text Blocks!', previousRef, ref);
} else if ([ref, previousRef].every((r) => r.block?.type === TextBlockType.MANUAL)) {
console.error('Overlapping MANUAL Text Blocks!', previousRef, ref);
// Make sure to select a TextBlockRef that has a feedback.
let selectedRef = ref;
if (!selectedRef.feedback) {
selectedRef = previousRef;
}

// Non-overlapping part of previousRef and ref should be added as a new text block (otherwise, some text is lost)
// But before, make sure that the selectedRef does not already cover the exact same range (otherwise, duplicate text blocks will appear)
if (selectedRef.block!.startIndex != previousRef.block!.startIndex! && selectedRef.block!.endIndex != nextIndex) {
TextAssessmentBaseComponent.addTextBlockByIndices(previousRef.block!.startIndex!, nextIndex, submission!, textBlockRefs);
}

ref = selectedRef;
} else {
// Find which block is Manual and only keep that one. Automatic block is stored in `unusedTextBlockRefs` in case we need to restore.
switch (TextBlockType.MANUAL) {
Expand Down
Loading