Mercurial > hg > Members > nobuyasu > Consensus
changeset 131:2b6e9496fb0c draft default tip
modified updateUserConsensusStatus
author | one |
---|---|
date | Fri, 26 Apr 2013 02:47:01 +0900 |
parents | 7052135c036c |
children | |
files | app/controllers/Claim.java |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/Claim.java Wed Apr 24 15:38:57 2013 +0900 +++ b/app/controllers/Claim.java Fri Apr 26 02:47:01 2013 +0900 @@ -107,19 +107,20 @@ return badRequest("Wrong status type."); } TPGraph tpGraph = TPGraph.getInstance(); - ClaimModel claim = new ClaimModel(tpGraph.getVertex(id)); - if (claim.getVertex() == null) { + ClaimModel targetClaim = new ClaimModel(tpGraph.getVertex(id)); + if (targetClaim.getVertex() == null) { return badRequest("Claim id "+id+" does not exist"); } + ClaimModel latestTgtClaim = new ClaimModel(tpGraph.getVertex(tpGraph.getLatestVertexId(targetClaim.getId()))); UserModel user = new UserModel(tpGraph.getVertex(name)); if (user.getVertex() == null) { return badRequest("User "+name+" does not exist"); } - claim.updateUserRequestStatus(claim, user, status); - Boolean notChanged = claim.computeAndUpdateStatus(); + latestTgtClaim.updateUserRequestStatus(latestTgtClaim, user, status); + Boolean notChanged = latestTgtClaim.computeAndUpdateStatus(); if (!notChanged) { String timestamp = Long.toString(System.currentTimeMillis()); - tpGraph.copyConsensusTree(claim, timestamp); + tpGraph.copyConsensusTree(latestTgtClaim, timestamp); } return created(); }