예제 #1
0
  private ClubRankingVO getClubRanking(Long seriesId) {
    final SeriesRankingVO seriesRanking = getSeriesRanking(seriesId);
    Map<Club, ClubResultVO> pointsPerClub = new HashMap<>();
    for (SeriesRankingCategoryVO c : seriesRanking.getCategories()) {
      int points = c.getAthletes().size();
      for (Athlete a : c.getAthletes()) {
        if (pointsPerClub.containsKey(a.getClub())) {
          ClubResultVO cr = pointsPerClub.get(a.getClub());
          cr.setPoints(cr.getPoints() + points);
        } else {
          ClubResultVO cr = new ClubResultVO();
          cr.setClub(a.getClub());
          cr.setPoints(points);
          pointsPerClub.put(a.getClub(), cr);
        }
        points--;
      }
    }

    ClubRankingVO cr = new ClubRankingVO();
    cr.setSeries(seriesRanking.getSeries());
    cr.setClubs(new ArrayList(pointsPerClub.values()));
    Collections.sort(cr.getClubs());
    return cr;
  }
예제 #2
0
 @Override
 public int compareTo(ClubResultVO o) {
   return o.getPoints().compareTo(points);
 }