Commits

Juan Carlos Picado Herrera  committed ae8bc58

In progress ENCUESTAME-446

  • Participants
  • Parent commits 59ff319

Comments (0)

Files changed (1)

File enme-mvc/src/main/java/org/encuestame/mvc/controller/json/FrontEndJsonController.java

     @RequestMapping(value = "/api/common/frontend/topusers.json", method = RequestMethod.GET)
     public @ResponseBody ModelMap getUserRatedTop(
         @RequestParam(value = "status", required = false) Boolean status,
+        @RequestParam(value = "end", required = false) Integer end,
+        @RequestParam(value = "start", required = false) Integer start,
         HttpServletRequest request,
         HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException {
         try {
             if (status == null ){
                 throw new EnMeSearchException("search params required.");
             } else {
-                final  List<ProfileRatedTopBean> itemList = getFrontService().getTopRatedProfile(status);
+                List<ProfileRatedTopBean> itemList = getFrontService().getTopRatedProfile(status);
+                if (start != null && end != null && start < end && end <= itemList.size()) {
+                    itemList = itemList.subList(start, end);
+                } else if(start != null && end == null) {
+                     itemList = itemList.subList(start, itemList.size());
+                }
                 jsonResponse.put("profile", itemList);
                 setItemResponse(jsonResponse);
                }