final ChangeControl cc = changeControlFactory.validateFor(id);
final Change change = cc.getChange();
final PatchSet.Id ps_id = change.currentPatchSetId();
final Map<ApprovalCategory.Id, PatchSetApproval> psas =
new HashMap<ApprovalCategory.Id, PatchSetApproval>();
final FunctionState fs =
functionStateFactory.create(cc, ps_id, psas.values());
for (final PatchSetApproval ca : db.patchSetApprovals()
.byPatchSetUser(ps_id, aid)) {
final ApprovalCategory.Id category = ca.getCategoryId();
if (ApprovalCategory.SUBMIT.equals(category)) {
continue;
}
if (change.getStatus().isOpen()) {
fs.normalize(approvalTypes.byId(category), ca);
}
if (ca.getValue() == 0) {
continue;
}
psas.put(category, ca);