diff options
author | Tomas Ljunggren <tomas.ljunggren@tieto.com> | 2011-11-11 14:17:42 +0100 |
---|---|---|
committer | Tomas Ljunggren <tomas.ljunggren@tieto.com> | 2011-11-11 15:53:34 +0100 |
commit | a68783d40c9296dc67bde4816ac8b54d65f3ff77 (patch) | |
tree | 644b489cb3fe0ac954174ea2e2750098e9cb42e2 | |
parent | 22d1f4695878b2f767921293e85275fcb7728697 (diff) |
Consider sanity review column
Changed the approval summary to consider the sanity review column
as sanity reviews are automated. Previously the sanity review
checkmark was only visible if reviewer self put +1 in sanity review.
Now it accomodates for the approval made by the sanity bot.
Change-Id: I64b803ff6f77ebc0c4bbb65ea308bc7a6b4aba72
Task-number: QTQAINFRA-350
Reviewed-by: Tomas Ljunggren <tomas.ljunggren@tieto.com>
-rw-r--r-- | gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java | 19 | ||||
-rw-r--r-- | gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java | 3 |
2 files changed, 15 insertions, 7 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java index a96c3c9384..300d1ae0d9 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java @@ -185,19 +185,24 @@ class PatchDetailServiceImpl extends BaseServiceImplementation implements functionStateFactory.create(change, ps_id, psas.values()); for (final PatchSetApproval ca : db.patchSetApprovals() - .byPatchSetUser(ps_id, aid)) { + .byPatchSet(ps_id)) { final ApprovalCategory.Id category = ca.getCategoryId(); if (ApprovalCategory.SUBMIT.equals(category) || ApprovalCategory.STAGING.equals(category)) { continue; } - if (change.getStatus().isOpen()) { - fs.normalize(approvalTypes.byId(category), ca); - } - if (ca.getValue() == 0) { - continue; + // Only process approval for account or if approval category is sanity review + if (ca.getAccountId().equals(aid) + || ApprovalCategory.SANITY_REVIEW.equals(category)) { + if (change.getStatus().isOpen()) { + fs.normalize(approvalTypes.byId(category), ca); + } + if (ca.getValue() == 0) { + continue; + } + psas.put(category, ca); } - psas.put(category, ca); + } approvals.put(id, new ApprovalSummary(psas.values())); diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java index ad170362df..dd6d02d935 100644 --- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java +++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/ApprovalCategory.java @@ -27,6 +27,9 @@ public final class ApprovalCategory { /** Id of the custom "Staging" category. */ public static final ApprovalCategory.Id STAGING = new ApprovalCategory.Id("STGN"); + /** Id of the sanity review category */ + public static final ApprovalCategory.Id SANITY_REVIEW = new ApprovalCategory.Id("SRVW"); + public static class Id extends StringKey<Key<?>> { private static final long serialVersionUID = 1L; |