Exemplo n.º 1
0
  public String getUserBowlPickTotalScore(User user) {
    Integer pointsPossible = 0;
    for (BowlMatchup matchup : this.getAllBowlMatchups()) {
      if (matchup.getWinningTeam() != null) {
        pointsPossible++;
      }
    }

    Integer points = 0;
    for (BowlPick pick : user.getBowlPicks()) {
      CfbTeam pickedTeam = pick.getSelectedTeam();
      CfbTeam winningTeam = pick.getBowlMatchup().getWinningTeam();
      if (pickedTeam != null && winningTeam != null) {
        if (pickedTeam.getCfbTeamId() == winningTeam.getCfbTeamId()) {
          points++;
        }
      }
    }

    return points + " / " + pointsPossible;
  }