/** * @param bowlPick * @return Scored pick status */ public BowlPickStatus scoreBowlPick(BowlPick bowlPick) { BowlMatchup matchup = bowlPick.getBowlMatchup(); if (matchup.getWinningTeam() == null && matchup.getLockFlag() == false) { return BowlPickStatus.OPEN; } if (matchup.getWinningTeam() == null && matchup.getLockFlag() == true) { return BowlPickStatus.LOCKED; } if (matchup.getWinningTeam().getCfbTeamId() == bowlPick.getSelectedTeam().getCfbTeamId()) { return BowlPickStatus.RIGHT; } return BowlPickStatus.WRONG; }
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; }