Skip to content

Commit

Permalink
Clean up code. #1409
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima committed Sep 14, 2023
1 parent 093d531 commit 08e5d7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AbstractIdeaCountTermEvaluator } from './AbstractIdeaCountTermEvaluator
const idea1 = new CRaterIdea('1', true);
const idea2 = new CRaterIdea('2', true);
const idea3 = new CRaterIdea('3', true);
const response_with_idea_1 = new CRaterResponse({ ideas: [idea1], ba: 1 });
const response_with_idea_1 = new CRaterResponse({ ideas: [idea1] });
const response_with_idea_2 = new CRaterResponse({ ideas: [idea2] });
const response_with_ideas_1_2 = new CRaterResponse({ ideas: [idea1, idea2] });
const response_with_ideas_1_2_3 = new CRaterResponse({ ideas: [idea1, idea2, idea3] });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class PeerChatQuestionBankComponent implements OnInit {
);
if (
this.content.questionBank.isPeerGroupingTagSpecified() &&
['OpenResponse', 'MultipleChoice'].includes(referenceComponent.content.type)
['MultipleChoice', 'OpenResponse'].includes(referenceComponent.content.type)
) {
this.evaluatePeerGroup(referenceComponent);
}
Expand Down Expand Up @@ -68,7 +68,7 @@ export class PeerChatQuestionBankComponent implements OnInit {
referenceComponent: WISEComponent,
peerGroupStudentData: PeerGroupStudentData[]
): QuestionBankRule[] {
const cRaterResponses = peerGroupStudentData.map((peerMemberData: PeerGroupStudentData) => {
const responses = peerGroupStudentData.map((peerMemberData: PeerGroupStudentData) => {
return new CRaterResponse({
ideas: peerMemberData.annotation?.data.ideas,
scores: peerMemberData.annotation?.data.scores,
Expand All @@ -85,7 +85,7 @@ export class PeerChatQuestionBankComponent implements OnInit {
);
feedbackRuleEvaluator.setReferenceComponent(referenceComponent);
return this.filterQuestions(
feedbackRuleEvaluator.getFeedbackRules(cRaterResponses) as QuestionBankRule[],
feedbackRuleEvaluator.getFeedbackRules(responses) as QuestionBankRule[],
this.content.questionBank.maxQuestionsToShow
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,17 @@ export abstract class DynamicPromptEvaluator {
protected getFeedbackRuleEvaluator(
referenceComponent: Component
): FeedbackRuleEvaluator<Response[]> {
const feedbackRuleComponent = new FeedbackRuleComponent(
this.component.dynamicPrompt.getRules(),
referenceComponent.content.maxSubmitCount,
false
);
const evaluator = this.component.dynamicPrompt.isPeerGroupingTagSpecified()
? new FeedbackRuleEvaluatorMultipleStudents(
new FeedbackRuleComponent(
this.component.dynamicPrompt.getRules(),
referenceComponent.content.maxSubmitCount,
false
),
feedbackRuleComponent,
this.component.constraintService
)
: new FeedbackRuleEvaluator(
new FeedbackRuleComponent(
this.component.dynamicPrompt.getRules(),
referenceComponent.content.maxSubmitCount,
false
),
this.component.constraintService
);
: new FeedbackRuleEvaluator(feedbackRuleComponent, this.component.constraintService);
evaluator.setReferenceComponent(referenceComponent);
return evaluator;
}
Expand Down

0 comments on commit 08e5d7b

Please sign in to comment.