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

SUP-1447, peer review updates #203

Merged
merged 11 commits into from
Oct 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
vm.scorecard = {
questions: {}
};
var handle = UserService.getUserIdentity().handle;
vm.submit = function() {
$state.go('review.status', {
challengeId: vm.challengeId
Expand All @@ -25,7 +26,7 @@

function activate() {
var promises = [
UserService.getUsername(),
handle,
ChallengeService.getChallengeDetails($stateParams.challengeId),
ReviewService.getReview($stateParams.reviewId),
ScorecardService.getScorecard(vm.challengeId)
Expand All @@ -34,7 +35,7 @@
$q.all(promises)
.then(function(response) {
var user = response[0].data;
vm.stats.username = user.handle;
vm.stats.username = handle;

var challenge = response[1].data;
vm.challenge = challenge;
Expand Down
3 changes: 3 additions & 0 deletions app/peer-review/completed-review/completed-review.jade
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
p.guidelines(ng-if="q.questionTypeId === 5", ng-repeat="guideline in q.guidelines track by $index") {{guideline}}

p.answer(ng-if="q.questionTypeId === 5") Your Response: {{q.answer}}

p.comment(ng-if="q.comment") Comment: {{q.comment}}

5 changes: 3 additions & 2 deletions app/peer-review/edit-review/edit-review.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
vm.scorecard = {
questions: {}
};
var handle = UserService.getUserIdentity().handle;

vm.submitReviewItems = function() {
var body = Helpers.compileReviewItems(vm.scorecard.questions, vm.review, vm.saved);
Expand Down Expand Up @@ -63,7 +64,7 @@

function activate() {
var promises = [
UserService.getUsername(),
handle,
ChallengeService.getChallengeDetails(vm.challengeId),
ReviewService.getReview($stateParams.reviewId),
ScorecardService.getScorecard(vm.challengeId)
Expand All @@ -72,7 +73,7 @@
$q.all(promises)
.then(function(response) {
var user = response[0].data;
vm.stats.username = user.handle;
vm.stats.username = handle;

var challenge = response[1].data;
vm.challenge = challenge;
Expand Down
4 changes: 4 additions & 0 deletions app/peer-review/edit-review/edit-review.jade
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
ng-class="{required: editForm.$submitted && optionForm.select.$error.required}")

p.required-message(ng-show="editForm.$submitted && optionForm.select.$error.required") Required
.comment
.label Comment
textarea.text(ng-init="q.comment = ''", ng-model="q.comment")


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

Expand Down
2 changes: 1 addition & 1 deletion app/services/challenge.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}

function getChallengeDetails(challengeId) {
var url = CONSTANTS.API_URL + '/challenges/' + challengeId;
var url = CONSTANTS.API_URL_V2 + '/challenges/' + challengeId;
return ApiService.requestHandler('GET', url, {}, true);
}

Expand Down
15 changes: 15 additions & 0 deletions app/services/helpers.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
questions[questionId].answer = answerObject.answer;
questions[questionId].reviewItemId = answerObject.id;

if (answerObject.comments && answerObject.comments.length > 0) {
// pick first comment for peer review challenges
questions[questionId].comment = answerObject.comments[0].content;
}

if (answerObject.answer !== '') {
saved = true;
}
Expand All @@ -129,6 +134,16 @@
answer: '' + q.answer
};

if (q.comment.length > 0) {
reviewItem.comments = [
{
content: '' + q.comment,
resourceId: review.resourceId,
commentTypeId: 1
}
];
}

if (updating) {
reviewItem.id = q.reviewItemId;
}
Expand Down
2 changes: 1 addition & 1 deletion app/services/review.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}

function getNextReview(challengeId) {
var url = CONSTANTS.API_URL + '/challenges/' + challengeId + '/assignNextReview';
var url = CONSTANTS.API_URL + '/reviews/' + challengeId + '/assignNextReview';
return ApiService.requestHandler('PUT', url);
}

Expand Down
15 changes: 11 additions & 4 deletions assets/css/peer-review/completed.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
@import '../partials/combined';

.completed-review-container {
form .scorecard .answer {
@include source-sans-italic;
margin: 25px 0;
padding-left: 30px;

form .scorecard {
.answer {
@include source-sans-italic;
margin: 25px 0;
padding-left: 30px;
}
.comment {
margin: 25px 0;
padding-left: 30px;
}
}
}
11 changes: 11 additions & 0 deletions assets/css/peer-review/edit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@

.required-message {
color: red;
}
}

.scorecard .comment {
margin-top: 15px;
margin-bottom: 20px;
.label {
margin: 10px 30px;
}
.text {
width: 60%;
margin-left: 30px;
}
}
Expand Down