Skip to content

Commit

Permalink
fix(Question Bank): Only mark questions the individual workgroup used
Browse files Browse the repository at this point in the history
Previously it would mark questions that any of the workgroups used.

#1413
  • Loading branch information
geoffreykwan committed Sep 14, 2023
1 parent 798b77f commit d1e19bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function getQuestionIdsUsed(componentStates: any[], workgroupId: number): string[] {
return componentStates
.filter((componentState) => componentState.workgroupId === workgroupId)
.filter((componentState) => componentState.studentData.questionId != null)
.map((componentState) => componentState.studentData.questionId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { NodeService } from '../../../services/nodeService';
import { FeedbackRule } from '../../common/feedbackRule/FeedbackRule';
import { QuestionBankRule } from '../peer-chat-question-bank/QuestionBankRule';
import { forkJoin, Observable } from 'rxjs';
import { getQuestionIdsUsed } from '../peer-chat-question-bank/question-bank-helper';

@Component({
selector: 'peer-chat-show-work',
Expand Down Expand Up @@ -102,7 +103,7 @@ export class PeerChatShowWorkComponent extends ComponentShowWorkDirective {
this.peerChatService.setPeerChatMessages(this.peerChatMessages, componentStates);
this.dynamicPrompt = this.getDynamicPrompt(componentStates, this.workgroupId);
this.questionBankRules = this.getQuestionBankRule(componentStates, this.workgroupId);
this.questionIdsUsed = this.getQuestionIdsUsed(componentStates, this.workgroupId);
this.questionIdsUsed = getQuestionIdsUsed(componentStates, this.workgroupId);
}

private getDynamicPrompt(componentStates: any[], workgroupId: number): FeedbackRule {
Expand Down Expand Up @@ -134,13 +135,6 @@ export class PeerChatShowWorkComponent extends ComponentShowWorkDirective {
return null;
}

private getQuestionIdsUsed(componentStates: any[], workgroupId: number): string[] {
return componentStates
.filter((componentState) => componentState.workgroupId === workgroupId)
.filter((componentState) => componentState.studentData.questionId != null)
.map((componentState) => componentState.studentData.questionId);
}

private addWorkgroupIdsFromPeerChatMessages(
workgroupIds: Set<number>,
componentStates: any[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { PeerChatMessage } from '../PeerChatMessage';
import { PeerChatService } from '../peerChatService';
import { PeerGroup } from '../PeerGroup';
import { Question } from '../peer-chat-question-bank/Question';
import { ComponentState } from '../../../../../app/domain/componentState';
import { QuestionBankService } from '../peer-chat-question-bank/questionBank.service';
import { getQuestionIdsUsed } from '../peer-chat-question-bank/question-bank-helper';

@Component({
selector: 'peer-chat-student',
Expand Down Expand Up @@ -124,7 +124,7 @@ export class PeerChatStudentComponent extends ComponentStudent {
]).subscribe(([componentStates, annotations]) => {
this.setPeerChatMessages(componentStates);
this.peerChatService.processIsDeletedAnnotations(annotations, this.peerChatMessages);
this.questionIdsUsed = this.getQuestionIdsUsed(componentStates);
this.questionIdsUsed = getQuestionIdsUsed(componentStates, this.myWorkgroupId);
});
}
},
Expand All @@ -134,12 +134,6 @@ export class PeerChatStudentComponent extends ComponentStudent {
);
}

private getQuestionIdsUsed(componentStates: ComponentState[]): string[] {
return componentStates
.filter((componentState) => componentState.studentData.questionId != null)
.map((componentState) => componentState.studentData.questionId);
}

private addTeacherWorkgroupIds(workgroupIds: number[]): void {
workgroupIds.push(...this.configService.getTeacherWorkgroupIds());
}
Expand Down

0 comments on commit d1e19bf

Please sign in to comment.