Fix: change list shows '1' instead of '-1' for label score.

If a user votes '-1', and then another user votes '+1' for a label, the
label will be shown as a red '1' in the change list instead of red '-1'.

Change the logic of setting the label score to handle this case properly.

Bug: Issue 2125
Change-Id: Icf32c11ddcda7a40ee162ac6829015b8fd1b3988
This commit is contained in:
Bruce Zu
2013-09-26 10:53:54 +08:00
committed by David Pursehouse
parent 8b7e9224c8
commit a7a3582291

View File

@@ -414,16 +414,16 @@ public class ChangeJson {
}
if (score != 0) {
if (score == type.getMax().getValue()) {
label.approved = accountLoader.get(accountId);
} else if (score == type.getMin().getValue()) {
if (score == type.getMin().getValue()) {
label.rejected = accountLoader.get(accountId);
} else if (score > 0) {
label.recommended = accountLoader.get(accountId);
label.value = score;
} 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;
}
}