@RequestMapping(value = path + "new") @ResponseBody public Request newVote(@RequestParam(value = phoneNumber) String inputNumber) throws URISyntaxException { User user = userManager.findByInputNumber(inputNumber, voteMenus + "new"); Long startTime = System.currentTimeMillis(); USSDMenu menu = initiateNewVote(user); log.info( "assembling vote selection menu took {} msecs ", (System.currentTimeMillis() - startTime)); return menuBuilder(menu); }
private USSDMenu initiateNewVote(User user) throws URISyntaxException { long startTime = System.currentTimeMillis(); int possibleGroups = permissionBroker.countActiveGroupsWithPermission( user, Permission.GROUP_PERMISSION_CREATE_GROUP_VOTE); log.info("counting groups took ... {} msecs", System.currentTimeMillis() - startTime); if (possibleGroups == 1) { Group group = permissionBroker .getActiveGroupsWithPermission(user, Permission.GROUP_PERMISSION_CREATE_GROUP_VOTE) .iterator() .next(); final String prompt = getMessage(thisSection, "issue", promptKey + ".skipped", group.getName(""), user); return setVoteGroupAndInitiateRequest(prompt, null, group.getUid(), "time", "", user); } else { return ussdGroupUtil.askForGroup( new USSDGroupUtil.GroupMenuBuilder(user, thisSection) .urlForExistingGroup("issue") .numberOfGroups(possibleGroups)); } }