Permalink
Browse files

Commented out stuff

  • Loading branch information...
1 parent f50a569 commit db6d43af684cae586737f21a406c28b46744ecad @Cronows Cronows committed Mar 22, 2012
Showing with 41 additions and 40 deletions.
  1. +41 −40 Frontend/app/controllers/ManagePoll.java
@@ -21,6 +21,7 @@
import api.responses.CreatePollInstanceResponse;
import api.responses.CreatePollResponse;
import api.responses.ReadPollResponse;
+import api.responses.ReadPollByTokenResponse;
import api.responses.ReadUserDetailsResponse;
import api.responses.Response;
import api.responses.UpdatePollResponse;
@@ -154,47 +155,47 @@ public static void clonepoll() {
public static void statistics() {
try {
- // Load service data.
- Response res0 = APIClient.loadServiceData("data.yml");
- if(!StatusCode.success(res0.statusCode)) {
- throw new Exception("Couldn't load test data.");
- }
- boolean authenticated = APIClient.authenticateSimple("spam@creen.dk", "openarms");
- if(!authenticated) {
- throw new Exception("Could not authenticate");
- }
-
- ReadPollResponse res1 = (ReadPollResponse)APIClient.send(new ReadPollByTokenRequest("123456"));
- if(!StatusCode.success(res1.statusCode)) {
- throw new Exception("Couldn't read poll with token 123456.");
- }
-
- PollInstanceJSON pi = new PollInstanceJSON();
- pi.poll_id = res1.poll.id;
- pi.start = Calendar.getInstance().getTime();
- Calendar endDateTimeCalendar = Calendar.getInstance();
- endDateTimeCalendar.set(Calendar.YEAR, 2020);
- pi.end = endDateTimeCalendar.getTime();
- CreatePollInstanceResponse res2 = (CreatePollInstanceResponse)APIClient.send(new CreatePollInstanceRequest(pi));
- if(!StatusCode.success(res2.statusCode)) {
- throw new Exception("Couldn't create poll instance with token time now.");
- }
-
- for(ChoiceJSON c: res1.poll.choices) {
- int voteCount = (int)(Math.round(Math.random()*100.0));
- for(int vIndex = 0; vIndex < voteCount; vIndex++) {
- Logger.debug("Creating a new vote (%d/%d) for choice %s on pollinstance %s", vIndex, voteCount, c.id, res2.pollinstance.id);
- VoteJSON v = new VoteJSON();
- v.choiceid = c.id;
- v.pollInstanceid = res2.pollinstance.id;
- VoteOnPollInstanceResponse res = (VoteOnPollInstanceResponse)APIClient.send(new VoteOnPollInstanceRequest(v));
- if(!StatusCode.success(res.statusCode)) {
- throw new Exception("Couldn't create vote.");
- }
- }
- }
+// // Load service data.
+// Response res0 = APIClient.loadServiceData("data.yml");
+// if(!StatusCode.success(res0.statusCode)) {
+// throw new Exception("Couldn't load test data.");
+// }
+// boolean authenticated = APIClient.authenticateSimple("spam@creen.dk", "openarms");
+// if(!authenticated) {
+// throw new Exception("Could not authenticate");
+// }
+//
+// ReadPollByTokenResponse res1 = (ReadPollByTokenResponse)APIClient.send(new ReadPollByTokenRequest("123456"));
+// if(!StatusCode.success(res1.statusCode)) {
+// throw new Exception("Couldn't read poll with token 123456.");
+// }
+//
+// PollInstanceJSON pi = new PollInstanceJSON();
+// pi.poll_id = res1.poll.id;
+// pi.start = Calendar.getInstance().getTime();
+// Calendar endDateTimeCalendar = Calendar.getInstance();
+// endDateTimeCalendar.set(Calendar.YEAR, 2020);
+// pi.end = endDateTimeCalendar.getTime();
+// CreatePollInstanceResponse res2 = (CreatePollInstanceResponse)APIClient.send(new CreatePollInstanceRequest(pi));
+// if(!StatusCode.success(res2.statusCode)) {
+// throw new Exception("Couldn't create poll instance with token time now.");
+// }
+//
+// for(ChoiceJSON c: res1.poll.choices) {
+// int voteCount = (int)(Math.round(Math.random()*100.0));
+// for(int vIndex = 0; vIndex < voteCount; vIndex++) {
+// Logger.debug("Creating a new vote (%d/%d) for choice %s on pollinstance %s", vIndex, voteCount, c.id, res2.pollinstance.id);
+// VoteJSON v = new VoteJSON();
+// v.choiceid = c.id;
+// v.pollInstanceid = res2.pollinstance.id;
+// VoteOnPollInstanceResponse res = (VoteOnPollInstanceResponse)APIClient.send(new VoteOnPollInstanceRequest(v));
+// if(!StatusCode.success(res.statusCode)) {
+// throw new Exception("Couldn't create vote.");
+// }
+// }
+// }
- Long pollinstance_id = res2.pollinstance.id;
+ Long pollinstance_id = (long)1; // res2.pollinstance.id;
render(pollinstance_id);
} catch(Exception e) {
e.printStackTrace();

0 comments on commit db6d43a

Please sign in to comment.