Skip to content

Commit 3b90c93

Browse files
authored
SAK-49867 Rubrics comment displays undefined when instructor grades (sakaiproject#12520)
Co-authored-by: Horner, Sean A <[email protected]>
1 parent b9bf11d commit 3b90c93

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

webcomponents/tool/src/main/frontend/packages/sakai-rubrics/src/SakaiRubricGradingComment.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class SakaiRubricGradingComment extends RubricsElement {
5959
aria-label="${this._i18n.criterion_comment}"
6060
class="form-control"
6161
name="rbcs-${this.evaluatedItemId}-${this.entityId}-criterion-comment-${this.criterion.id}"
62-
.value=${this.criterion.comments}
62+
.value=${this.criterion.comments === undefined ? null : this.criterion.comments}
6363
id="criterion-${this.criterion.id}-${this.evaluatedItemId}-comment-${this.randombit}">
6464
</textarea>
6565
</div>
@@ -79,13 +79,6 @@ export class SakaiRubricGradingComment extends RubricsElement {
7979
const editorKey = `criterion-${this.criterion.id}-${this.evaluatedItemId}-comment-${this.randombit}`;
8080

8181
try {
82-
/*
83-
const commentEditor = CKEDITOR.replace(editorKey, {
84-
startupFocus: true,
85-
toolbar: [ [ "Bold", "Italic", "Underline" ], [ "NumberedList", "BulletedList", "Blockquote" ] ],
86-
height: 40
87-
});
88-
*/
8982
const commentEditor = sakai.editor.launch(editorKey, {
9083
startupFocus: true,
9184
versionCheck: false,
@@ -100,8 +93,8 @@ export class SakaiRubricGradingComment extends RubricsElement {
10093

10194
// When we click away from the comment editor we need to save the comment, but only if the comment has been updated
10295
const updatedComments = commentEditor.getData();
103-
104-
if (this.criterion.comments !== updatedComments) {
96+
const nonEmptyComment = this.criterion.comments !== undefined || updatedComments.trim().length > 0;
97+
if (this.criterion.comments !== updatedComments && nonEmptyComment) {
10598
this.criterion.comments = updatedComments;
10699
const updateEvent = new CustomEvent("update-comment", {
107100
detail: {
@@ -112,6 +105,7 @@ export class SakaiRubricGradingComment extends RubricsElement {
112105
},
113106
bubbles: true, composed: true });
114107
this.dispatchEvent(updateEvent);
108+
this.requestUpdate();
115109
}
116110

117111
this.hideTooltip();

0 commit comments

Comments
 (0)