// Get details of Task/Card/Story
  @RequestMapping(value = "/{userId}/edit/{type}/{typeId}", method = RequestMethod.GET)
  public String getTypeDetails(
      @ModelAttribute("project") Project project,
      @PathVariable Long userId,
      @PathVariable String type,
      @PathVariable Long typeId,
      ModelMap model) {

    if (type.contentEquals("story")) {
      List ls = userDao.getStoryById(typeId);
      Story s = (Story) ls.get(0);
      model.addAttribute("story", s);
    } else if (type.contentEquals("cards")) {
      List lc = userDao.getCardById(typeId);
      Card c = (Card) lc.get(0);
      model.addAttribute("cards", c);
    } else if (type.contentEquals("tasks")) {
      List lt = userDao.getTaskById(typeId);
      Task t = (Task) lt.get(0);
      model.addAttribute("tasks", t);
    }

    List p = userDao.getProjectById(userId);
    Project ps = (Project) p.get(0);
    model.addAttribute("project", ps.getProjectname());
    model.addAttribute("type", type);
    model.addAttribute("userid", userId);
    return "Details";
  }
  // Redirect to Add page to create new Task/Card/Story
  @RequestMapping(value = "/{userId}/add/{type}", method = RequestMethod.GET)
  public String getAdd(
      @ModelAttribute("project") Project project,
      @PathVariable Long userId,
      @PathVariable String type,
      ModelMap model) {

    List p = userDao.getProjectById(userId);
    Project ps = (Project) p.get(0);
    model.addAttribute("project", ps.getProjectname());
    model.addAttribute("type", type);
    model.addAttribute("userid", userId);
    return "Add";
  }
  // Get project status
  @RequestMapping(value = "/{userId}/status", method = RequestMethod.GET)
  public String showStatus(@PathVariable Long userId, ModelMap model) throws SQLException {
    User u = (User) userDao.getUserById(userId).get(0);
    Project p = (Project) userDao.getProjectById(userId).get(0);

    if (u.getTenanttype().contentEquals("kanban")) {
      List l = userDao.cardCount(userId);
      List<Object[]> resultList = l;
      Map<String, Integer> resultMap = new HashMap<>(resultList.size());
      int a[] = new int[4];
      int i = 0;

      for (Object[] result : resultList) {
        String name = (String) result[0];
        int count = ((Number) result[1]).intValue();
        a[i] = count;
        i++;
        resultMap.put(name, count);
      }
      model.addAttribute("a", a);
    } else if (u.getTenanttype().contentEquals("scrum")) {

      List<Long> t = userDao.tCount(userId);
      List<Long> r = userDao.rCount(userId);

      Long tr = t.get(0);
      Long rr = r.get(0);

      int tHours = Long.valueOf(tr).intValue();
      int rHours = Long.valueOf(rr).intValue();

      List<Integer> actual = new ArrayList<>();
      List<Integer> initial = new ArrayList<>();

      int burnDown = 2 * 5;

      while (rHours > 0) {
        actual.add(rHours);
        rHours = rHours - burnDown;
      }

      while (tHours > 0) {
        initial.add(tHours);
        tHours = tHours - burnDown;
      }
      int k = 0;
      int l = 1;

      List<Integer[]> dataArray = new ArrayList<>();
      for (int item : actual) {
        Integer[] o = {k, item, initial.get(k)};
        dataArray.add(o);
        k++;
      }

      if (initial.size() > actual.size()) {
        for (int item : initial) {
          if (l > actual.size()) {
            Integer[] o = {l, 0, item};
            dataArray.add(o);
          }
          l++;
        }
        Integer[] o = {l, 0, 0};
        dataArray.add(o);
      } else if (initial.size() < actual.size()) {
        for (int item : initial) {
          if (l > initial.size()) {
            Integer[] o = {l, item, 0};
            dataArray.add(o);
          }
          l++;
        }
        Integer[] o = {l, 0, 0};
        dataArray.add(o);
      } else if (initial.size() == actual.size()) {
        Integer[] o = {k, 0, 0};
        dataArray.add(o);
      }
      model.addAttribute("dataArray", dataArray);
    } else if (u.getTenanttype().contentEquals("waterfall")) {

      List l = userDao.taskCount(userId);
      List<Object[]> resultList = l;
      Map<String, Integer> resultMap = new HashMap<>(resultList.size());
      int a[] = {0, 0, 0};

      for (Object[] result : resultList) {
        String name = (String) result[0];
        int count = ((Number) result[1]).intValue();
        if (name.contentEquals("Requested")) {
          a[0] = count;
        } else if (name.contentEquals("In Progress")) {
          a[1] = count;
        } else if (name.contentEquals("Completed")) {
          a[2] = count;
        }
        resultMap.put(name, count);
      }
      model.addAttribute("a", a);
    }

    model.addAttribute("tenant", u.getTenanttype());
    model.addAttribute("project", p.getProjectname());
    model.addAttribute("userid", userId);

    return "Status";
  }