-
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
refactor(AnnotationService): getLatestScoreAnnotation() #1469
refactor(AnnotationService): getLatestScoreAnnotation() #1469
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.
Works well.
I'm wondering if getLatestScoreAnnotation() should return null for consistency. There's also a slight difference in behavior between null and undefined.
Calling this
JSON.stringify({a: null, b: undefined})
Returns this
'{"a":null}'
I'm wondering if that will come into play in places like this or similar places.
WISE-Client/src/assets/wise5/components/embedded/embedded-show-work/embedded-show-work.component.ts
Lines 117 to 134 in 5191b41
const latestScoreAnnotation = this.AnnotationService.getLatestScoreAnnotation( | |
this.nodeId, | |
this.componentId, | |
workgroupId, | |
type | |
); | |
const latestCommentAnnotation = this.AnnotationService.getLatestCommentAnnotation( | |
this.nodeId, | |
this.componentId, | |
workgroupId, | |
type | |
); | |
const message = { | |
messageType: 'latestAnnotations', | |
latestScoreAnnotation: latestScoreAnnotation, | |
latestCommentAnnotation: latestCommentAnnotation | |
}; | |
this.sendMessageToApplication(message); |
and
WISE-Client/src/assets/wise5/components/embedded/embedded-student/embedded-student.component.ts
Lines 236 to 253 in 5191b41
const latestScoreAnnotation = this.AnnotationService.getLatestScoreAnnotation( | |
this.nodeId, | |
this.componentId, | |
workgroupId, | |
type | |
); | |
const latestCommentAnnotation = this.AnnotationService.getLatestCommentAnnotation( | |
this.nodeId, | |
this.componentId, | |
workgroupId, | |
type | |
); | |
const message = { | |
messageType: 'latestAnnotations', | |
latestScoreAnnotation: latestScoreAnnotation, | |
latestCommentAnnotation: latestCommentAnnotation | |
}; | |
this.sendMessageToApplication(message); |
return ( | ||
['autoScore', 'score'].includes(annotation.type) && | ||
(scoreType === 'any' || annotation.type === scoreType) | ||
); |
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 be something like this to be more concise?
return (
(scoreType === 'any' && ['autoScore', 'score'].includes(annotation.type)) ||
annotation.type === scoreType
);
Refactor matchesScoreType()
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.
Changes
Array.filter()
andArray.at()
undefined
instead ofnull
if there is no latest score or auto-scoreTest