Skip to content

Commit 66f3c79

Browse files
feat(Match): Filter out detected ideas from pre-authored choices #2184 (#2185)
Co-authored-by: Jonathan Lim-Breitbart <[email protected]>
1 parent b8dfa21 commit 66f3c79

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/assets/wise5/components/match/match-student/match-student-default/match-student-default.component.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { NotebookService } from '../../../../services/notebookService';
3838
import { ProjectService } from '../../../../services/projectService';
3939
import { StudentAssetService } from '../../../../services/studentAssetService';
4040
import { StudentDataService } from '../../../../services/studentDataService';
41+
import { CRaterIdea } from '../../../common/cRater/CRaterIdea';
4142

4243
@Component({
4344
imports: [
@@ -613,11 +614,17 @@ export class MatchStudentDefaultComponent extends ComponentStudent {
613614
}
614615

615616
private addIdeasToSourceBucket(responses: any[], rubric: CRaterRubric): void {
616-
getUniqueIdeas(responses, rubric).forEach((idea) => {
617-
const choice = new Choice(idea.name, idea.text);
618-
this.choices.push(choice);
619-
this.getBucketById(this.sourceBucketId).items.push(choice);
620-
});
617+
getUniqueIdeas(responses, rubric)
618+
.filter((idea) => !this.isInSourceBucket(idea))
619+
.forEach((idea) => {
620+
const choice = new Choice(idea.name, idea.text);
621+
this.choices.push(choice);
622+
this.getBucketById(this.sourceBucketId).items.push(choice);
623+
});
624+
}
625+
626+
private isInSourceBucket(idea: CRaterIdea): boolean {
627+
return this.sourceBucket.items.some((item) => item.value === idea.text);
621628
}
622629

623630
protected addChoice(): void {

src/messages.xlf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10945,7 +10945,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
1094510945
</context-group>
1094610946
<context-group purpose="location">
1094710947
<context context-type="sourcefile">src/assets/wise5/components/match/match-student/match-student-default/match-student-default.component.ts</context>
10948-
<context context-type="linenumber">125</context>
10948+
<context context-type="linenumber">126</context>
1094910949
</context-group>
1095010950
<context-group purpose="location">
1095110951
<context context-type="sourcefile">src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
@@ -19584,7 +19584,7 @@ Warning: This will delete all existing choices and buckets in this component.</s
1958419584
</context-group>
1958519585
<context-group purpose="location">
1958619586
<context context-type="sourcefile">src/assets/wise5/components/match/match-student/match-student-default/match-student-default.component.ts</context>
19587-
<context context-type="linenumber">470</context>
19587+
<context context-type="linenumber">471</context>
1958819588
</context-group>
1958919589
<context-group purpose="location">
1959019590
<context context-type="sourcefile">src/assets/wise5/components/multipleChoice/multiple-choice-show-work/multiple-choice-show-work.component.html</context>
@@ -19615,7 +19615,7 @@ Warning: This will delete all existing choices and buckets in this component.</s
1961519615
</context-group>
1961619616
<context-group purpose="location">
1961719617
<context context-type="sourcefile">src/assets/wise5/components/match/match-student/match-student-default/match-student-default.component.ts</context>
19618-
<context context-type="linenumber">470</context>
19618+
<context context-type="linenumber">471</context>
1961919619
</context-group>
1962019620
<context-group purpose="location">
1962119621
<context context-type="sourcefile">src/assets/wise5/components/multipleChoice/multiple-choice-show-work/multiple-choice-show-work.component.html</context>
@@ -19680,7 +19680,7 @@ Warning: This will delete all existing choices and buckets in this component.</s
1968019680
<source>Correct bucket but wrong position</source>
1968119681
<context-group purpose="location">
1968219682
<context context-type="sourcefile">src/assets/wise5/components/match/match-student/match-student-default/match-student-default.component.ts</context>
19683-
<context context-type="linenumber">463</context>
19683+
<context context-type="linenumber">464</context>
1968419684
</context-group>
1968519685
</trans-unit>
1968619686
<trans-unit id="3309404570196522710" datatype="html">

0 commit comments

Comments
 (0)