-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat(Feedback Rule): New myChoiceChosen token #1410
feat(Feedback Rule): New myChoiceChosen token #1410
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
The choseChoice rules do not work in Peer Chat Dynamic Prompt and Question Bank if the Reference Component is set to the Multiple Choice component. It only works if the Reference Component is set to an Open Response CRater component.
-
Ideally you should be able to set the Reference Component to the Multiple Choice component and then only need to specify the choice id in the expression like
choseChoice("mdfmfybcuw")
. -
You can't choose Multiple Choice components in the Reference Component. In the Component drop down, Multiple Choice components are greyed out and can't be selected.
DynamicPrompt and QuestionBank, which use ReferenceComponent to look up work for the component #1409
@geoffreykwan I addressed those issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I test the Peer Chat in preview the questions in the question bank show up properly but when I test with an actual run, the questions don't show up and this error is thrown in the browser console.
ERROR TypeError: Cannot read properties of undefined (reading 'length')
at PeerChatQuestionBankComponent.filterQuestions (peer-chat-question-bank.component.ts:105:38)
at PeerChatQuestionBankComponent.chooseQuestionBankRulesToDisplay (peer-chat-question-bank.component.ts:87:17)
at Object.next (peer-chat-question-bank.component.ts:57:38)
It looks like in peer-chat-question-bank.component.ts line 71 the peerGroupStudentData is an empty array even though both of my students have submitted the Multiple Choice. In preview, it retrieves the student data locally but in a real run it retrieves the work from the API and it looks like the API is returning an empty array.
} | ||
} | ||
super(jsonObject); | ||
this.populateFields(jsonObject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this call to populateFields() necessary if the parent also calls it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we run the unit tests, because we initialize the ideas variable to an empty array ideas: CRaterIdea[] = [];
in the class declaration, the webpack compiler (I think) adds this line below the line super(jsonObject) this.ideas = [];
. If we don't call this.populateFields(jsonObject)
again, the ideas fields is always an empty array, and causes the tests to fail. So in effect, this line is there just to make the tests pass, which is not ideal.
This problem goes away if we don't initialize the ideas variable to an empty array, but this may cause side-effects with the actual behavior of the program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like somewhat unexpected behavior but is good to know for the future.
@@ -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] }); | |||
const response_with_idea_1 = new CRaterResponse({ ideas: [idea1], ba: 1 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the ba: 1 needed here? I can't tell what it's for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using this for testing something. Removed.
@@ -28,7 +28,7 @@ export class FeedbackRuleExpression { | |||
return this.text | |||
.replace(/ /g, '') | |||
.split( | |||
/(hasKIScore\(\d\)|accumulatedIdeaCountEquals\(\d\)|accumulatedIdeaCountLessThan\(\d\)|accumulatedIdeaCountMoreThan\(\d\)|ideaCountEquals\(\S+\)|ideaCountLessThan\(\S+\)|ideaCountMoreThan\(\S+\)|isSubmitNumber\(\d+\)|&&|\|\||!|\(|\))/g | |||
/(hasKIScore\(\d\)|accumulatedIdeaCountEquals\(\d\)|accumulatedIdeaCountLessThan\(\d\)|accumulatedIdeaCountMoreThan\(\d\)|ideaCountEquals\(\S+\)|ideaCountLessThan\(\S+\)|ideaCountMoreThan\(\S+\)|myChoiceChosen\(\S+\)|isSubmitNumber\(\d+\)|&&|\|\||!|\(|\))/g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split this up into multiple lines to make it more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spent 30 minutes on this but couldn't figure it out. Can you? Or, in the interest of moving forward, let's save this for another time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try something like this but we can do it later
@@ -70,8 +70,8 @@ export class PeerChatQuestionBankComponent implements OnInit { | |||
): QuestionBankRule[] { | |||
const cRaterResponses = peerGroupStudentData.map((peerMemberData: PeerGroupStudentData) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this variable be renamed to responses
since it can now be Multiple Choice responses too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
if ( | ||
this.content.questionBank.isPeerGroupingTagSpecified() && | ||
referenceComponent.content.type === 'OpenResponse' | ||
['OpenResponse', 'MultipleChoice'].includes(referenceComponent.content.type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the order of the component types be alphabetical like in the other locations? Ideally all these locations would just reference a single array somewhere that contains ['MultipleChoice', 'OpenResponse'].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Maybe in a ReferenceableComponents class or isReferenceableComponent() function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, somewhere to put the single source of truth to avoid duplication.
const evaluator = this.component.dynamicPrompt.isPeerGroupingTagSpecified() | ||
? new FeedbackRuleEvaluatorMultipleStudents( | ||
new FeedbackRuleComponent( | ||
this.component.dynamicPrompt.getRules(), | ||
referenceComponent.content.maxSubmitCount, | ||
false | ||
), | ||
this.component.constraintService | ||
) | ||
: new FeedbackRuleEvaluator( | ||
new FeedbackRuleComponent( | ||
this.component.dynamicPrompt.getRules(), | ||
referenceComponent.content.maxSubmitCount, | ||
false | ||
), | ||
this.component.constraintService | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new FeedbackRuleComponent() the same in both cases? If so, can it be done once and set into a single variable.
new FeedbackRuleComponent(
this.component.dynamicPrompt.getRules(),
referenceComponent.content.maxSubmitCount,
false
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Changed.
I forgot to note that you need to test this PR with WISE-Community/WISE-API#235. My bad. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality is working well. 👍
I did find one minor grading issue, but it exists on production and applies to all Peer Chat Question Banks. So we should make a separate issue. This is the problem:
The grading view can show different Question Bank questions than what the students see. This happens when a workgroup adds something to the chat and then goes back to the reference component and changes their answer. When the workgroup revisits the Peer Chat component, the Question Bank will update based on the students' latest response in the reference component. But the grading view will show the old Question Bank questions because the student hasn't submitted any more work to the Peer Chat component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
🎉 This PR is included in version 5.111.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Changes
myChoiceChosen("choiceId")
token that returns true when the student chose the specified choice as their last response for the reference component.Test
myChoiceChosen("choiceId")
in the FeedbackRule expression for Dynamic Prompt, Question Bank and make sure that the rule is matched if the student chose the specified choice for the reference component. If should not match otherwise.Closes #1409