| Issue 2723: | change detail REST API missing vote information for labels | |
| 1 person starred this issue and may be notified of changes. | Back to list |
The change detail REST API does not return all votes on a label. This issue seems like a regression because it seems to work ok on gerrit ver 2.8 Affected Version: master What steps will reproduce the problem? 1. push a change to gerrit 2. have 2 users vote on that change (CR+1 and CR-1). 3. use the change detail api to retrieve the change info https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change-detail What is the expected output? What do you see instead? I would expect the json to contain a "dislike" and "recommend" for "Code-Review" label. What i see instead is that there is a dislike but no recommend. "all" for code-review shows both the +1 and -1 scores from both users. Please provide any additional information below. I have attached the json from my test instance showing the problem.
Jun 20, 2014
Ahh. Is this documented anywhere? if not then probably would be good to add documentation for it. It was confusing to me because the sample response in the doc has both "dislike" and "recommend" for the code-review label.
Jun 22, 2014
documentation add in change https://gerrit-review.googlesource.com/#/c/58020
Jun 22, 2014
(No comment was entered for this change.)
Status:
ChangeUnderReview
Jun 23, 2014
(No comment was entered for this change.)
Status:
Submitted
|
|
| ► Sign in to add a comment |
No. It works as designed. You are missing that those four votes per label are combined votes, so obviously only one vote from four can be set: * rejected * approved * disliked * recommended The priority for combined vote calculation is as following (from highest to lowest): REJECTED > APPROVED > DISLIKED > RECOMMENDED Or following the pattern "Talk is cheap, show me the code" [1]: [1] if (score != 0) { if (score == type.getMin().getValue()) { label.rejected = accountLoader.get(accountId); } else if (score == type.getMax().getValue()) { label.approved = accountLoader.get(accountId); } else if (score < 0) { label.disliked = accountLoader.get(accountId); label.value = score; } else if (score > 0 && label.disliked == null) { label.recommended = accountLoader.get(accountId); label.value = score; } } [1] https://gerrit.googlesource.com/gerrit/+/master/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java:430