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

Commit c479cbd

Browse files
author
Parth Shah
committedFeb 10, 2016
more fixes
1 parent ed1c32e commit c479cbd

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed
 

‎app/peer-review/completed-review/completed-review.controller.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,34 @@
2525

2626
function activate() {
2727
var promises = [
28-
handle,
2928
ChallengeService.getChallengeDetails($stateParams.challengeId),
3029
ReviewService.getReview($stateParams.reviewId),
3130
ScorecardService.getScorecard(vm.challengeId)
3231
];
3332

3433
$q.all(promises)
35-
.then(function(response) {
36-
var user = response[0].data;
34+
.then(function(responses) {
3735
vm.stats.username = handle;
3836

39-
var challenge = response[1].data;
40-
vm.challenge = challenge;
37+
vm.challenge = responses[0];
4138

42-
var reviewData = response[2].data.result.content;
43-
vm.review = reviewData;
44-
vm.stats.submissionId = reviewData.submissionId;
45-
vm.stats.uploadId = reviewData.uploadId;
46-
vm.stats.createdAt = reviewData.createdAt;
47-
vm.stats.updatedAt = reviewData.updatedAt;
39+
vm.review = responses[1];
40+
vm.stats.submissionId = vm.review.submissionId;
41+
vm.stats.uploadId = vm.review.uploadId;
42+
vm.stats.createdAt = vm.review.createdAt;
43+
vm.stats.updatedAt = vm.review.updatedAt;
4844

49-
var scorecardData = response[3].data.result.content[0];
45+
var scorecardData = responses[2][0];
5046
var scorecardId = scorecardData.id;
5147

5248
ScorecardService.getScorecardQuestions(scorecardId)
53-
.then(function(data) {
54-
var questions = data.data.result.content;
55-
49+
.then(function(questions) {
5650
Helpers.storeById(vm.scorecard.questions, questions);
5751
Helpers.parseQuestions(vm.scorecard.questions);
5852

5953
return ReviewService.getReviewItems($stateParams.reviewId);
6054

61-
}).then(function(data) {
62-
var answers = data.data.result.content;
55+
}).then(function(answers) {
6356

6457
Helpers.parseAnswers(vm.scorecard.questions, answers);
6558

‎app/services/review.service.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@
5252
// var method = isPreviouslySaved ? 'PUT' : 'POST';
5353
// var url = CONSTANTS.API_URL + '/reviewItems/';
5454
// return ApiService.requestHandler(method, url, JSON.stringify(body));
55-
// body = JSON.stringify(body);
5655
if (isPreviouslySaved) {
5756
return api.all('reviewItems').customPUT(body, null, null, null)
5857
} else {
59-
return api.all('reivewItems').post(body)
58+
return api.all('reviewItems').post(body)
6059
}
6160
}
6261

@@ -67,7 +66,7 @@
6766
id: reviewId
6867
}
6968
// return ApiService.requestHandler('PUT', url, JSON.stringify(body));
70-
api.one('reviews', reviewId).put()
69+
return api.one('reviews', reviewId).customPUT(body, null, null, null)
7170
}
7271
};
7372
})();

‎app/services/scorecard.service.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@
1818

1919
function getScorecardById(scorecardId) {
2020
return api.all('scorecards').getList({filter: encodeURIComponent("scorecardId="+scorecardId)})
21+
.then(function(data) {
22+
return data.plain()
23+
})
2124
}
2225

2326
function getScorecard(challengeId) {
2427
return api.all('scorecards').getList({filter: encodeURIComponent("challengeId="+challengeId)})
28+
.then(function(data) {
29+
return data.plain()
30+
})
2531
}
2632

2733
function getScorecardQuestions(scorecardId) {
2834
return api.all('scorecardQuestions').getList({filter: encodeURIComponent("scorecardId="+scorecardId)})
35+
.then(function(data) {
36+
return data.plain()
37+
})
2938
}
3039
};
3140
})();

0 commit comments

Comments
 (0)
This repository has been archived.