Mercurial > hg > Members > nobuyasu > Consensus
changeset 38:a2abe67d7c7a
fix createMention action bug
author | one |
---|---|
date | Thu, 04 Oct 2012 01:05:19 +0900 |
parents | bc3ac73320f9 |
children | 870553e92e3e |
files | app/controllers/Claim.java app/models/ClaimModel.java logs/application.log test/RequestTest.java |
diffstat | 4 files changed, 32 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/Claim.java Thu Oct 04 00:31:09 2012 +0900 +++ b/app/controllers/Claim.java Thu Oct 04 01:05:19 2012 +0900 @@ -81,7 +81,7 @@ public static Result createMention(String mentionType, String id) { if ( !(mentionType.equals(NodeModel.L_QUESTION) ||mentionType.equals(NodeModel.L_REFUTATION) - ||mentionType.equals(NodeModel.L_QUESTION))) { + ||mentionType.equals(NodeModel.L_SUGGESTION))) { return badRequest("Wrong mention type."); } JsonNode json = request().body().asJson();
--- a/app/models/ClaimModel.java Thu Oct 04 00:31:09 2012 +0900 +++ b/app/models/ClaimModel.java Thu Oct 04 01:05:19 2012 +0900 @@ -55,7 +55,7 @@ pipeChildVertex.start(e).inV(); ClaimModel childClaim = new ClaimModel(pipeChildVertex.next()); info.put(CLAIM, childClaim.getClaimInfoTraverse()); - info.put(MENTIONS, Json.toJson(childClaim.getClaimMentionsRecursive())); + info.put(ID, Json.toJson(childClaim.getId())); array.add(info); } return array.toArray();
--- a/logs/application.log Thu Oct 04 00:31:09 2012 +0900 +++ b/logs/application.log Thu Oct 04 01:05:19 2012 +0900 @@ -1,12 +1,24 @@ -2012-10-03 23:52:13,026 - [INFO] - from play in main +2012-10-04 00:57:27,766 - [INFO] - from play in main Listening for HTTP on port 9000... -2012-10-03 23:52:27,823 - [INFO] - from play in play-akka.actor.default-dispatcher-2 +2012-10-04 00:57:32,759 - [INFO] - from play in play-akka.actor.default-dispatcher-1 +Application started (Dev) + +2012-10-04 01:01:31,070 - [INFO] - from application in play-akka.actor.default-dispatcher-1 +Application shutdown... + +2012-10-04 01:01:31,090 - [INFO] - from play in play-akka.actor.default-dispatcher-1 Application started (Dev) -2012-10-03 23:55:53,105 - [INFO] - from application in play-akka.actor.default-dispatcher-2 +2012-10-04 01:04:06,784 - [INFO] - from application in play-akka.actor.default-dispatcher-2 Application shutdown... -2012-10-03 23:55:53,125 - [INFO] - from play in play-akka.actor.default-dispatcher-2 +2012-10-04 01:04:06,801 - [INFO] - from play in play-akka.actor.default-dispatcher-2 Application started (Dev) +2012-10-04 01:04:11,405 - [INFO] - from application in play-akka.actor.default-dispatcher-2 +Application shutdown... + +2012-10-04 01:04:11,430 - [INFO] - from play in play-akka.actor.default-dispatcher-2 +Application started (Dev) +
--- a/test/RequestTest.java Thu Oct 04 00:31:09 2012 +0900 +++ b/test/RequestTest.java Thu Oct 04 01:05:19 2012 +0900 @@ -20,10 +20,12 @@ String user1 = "akifumi"; String user2 = "takaaki"; String user3 = "yosiaki"; + String user4 = "suzuki"; createUser(user1); createUser(user2); createUser(user3); - String[] users1 = {user2,user3}; + createUser(user4); + String[] users1 = {user2,user3,user4}; createClaim(user1, users1); String[] users2 = {user2}; createClaim(user1, users2); @@ -36,21 +38,27 @@ int claimId = user1Claim.get(i).asInt(); createMention(user2, users3, NodeModel.L_QUESTION, claimId); createMention(user3, users3, NodeModel.L_REFUTATION, claimId); - getClaimInfo(claimId); } + JsonNode user2Claim = getUserInfo(user2,"claims/"); + for (int i=0; i<user2Claim.size(); i++) { + int claimId = user2Claim.get(i).asInt(); + System.out.println("claimId = "+claimId); + String[] users = {user2}; + createMention(user1, users, NodeModel.L_SUGGESTION, claimId); + } + +/* getUserInfo(user1,"requests/"); getUserInfo(user1,"consensus/"); getUserInfo(user2,"claims/"); + getUserInfo(user2,"consensus/"); getUserInfo(user3,"claims/"); getUserInfo(user3,"consensus/"); +*/ for (int i=0; i<user1Claim.size(); i++) { int id = user1Claim.get(i).asInt(); getClaimTree(id); - getClaimInfo(user1Claim.get(i).asInt()); - editClaimInfo(user1, users1, id); - getClaimInfo(user1Claim.get(i).asInt()); - break; } }