Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 1828c28

Browse files
author
vikasrohit
committed
SUP-1447, Peer review updates
Cherry picked changes for following commits into peer-review app 1) Initialize comment as an empty string, refactor helper logic Commit: 3ca3272666c64aa4dba072d41223dd7ed53b6f41 [3ca3272] Parents: b9669d651b Author: Nick Litwin <[email protected]> Date: 1 August 2015 2:58:10 am IST Labels: HEAD origin/dev origin/HEAD dev
1 parent 4ae69b5 commit 1828c28

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

app/peer-review/edit-review/edit-review.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
p.required-message(ng-show="editForm.$submitted && optionForm.select.$error.required") Required
4343
.comment
4444
.label Comment
45-
textarea.text(ng-model="q.comment")
45+
textarea.text(ng-init="q.comment = ''", ng-model="q.comment")
4646

4747

4848
button(type="submit") Save and Mark Complete

app/services/helpers.service.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
if (answerObject.comments && answerObject.comments.length > 0) {
104104
// pick first comment for peer review challenges
105105
questions[questionId].comment = answerObject.comments[0].content;
106-
questions[questionId].comments = answerObject.comments;
107106
}
108107

109108
if (answerObject.answer !== '') {
@@ -124,18 +123,17 @@
124123
reviewId: review.id,
125124
scorecardQuestionId: parseInt(qId),
126125
uploadId: review.uploadId,
127-
answer: '' + q.answer,
128-
comments: q.comments
126+
answer: '' + q.answer
129127
};
130128

131-
if (reviewItem.comments && reviewItem.comments.length > 0) {
132-
reviewItem.comments[0].content = q.comment;
133-
} else {
134-
reviewItem.comments = [{
135-
content: '' + q.comment,
136-
resourceId: review.resourceId,
137-
commentTypeId: 1
138-
}];
129+
if (q.comment.length > 0) {
130+
reviewItem.comments = [
131+
{
132+
content: '' + q.comment
133+
resourceId: review.resourceId
134+
commentTypeId: 1
135+
}
136+
];
139137
}
140138

141139
if (updating) {

0 commit comments

Comments
 (0)