Class ChallengeRanking
java.lang.Object
fr.utc.miage.sporttrack.entity.event.ChallengeRanking
JPA entity representing a single ranking entry within a
Challenge.
Each ranking associates an athlete with a rank position and a cumulative score for the challenge's performance metric. Convenience methods are provided to obtain a display name and a formatted score string for presentation in the user interface.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the athlete associated with this ranking.Returns the challenge to which this ranking belongs.Returns the display name of the ranked athlete.Returns the score formatted for display in the French locale.intgetId()Returns the unique identifier of this ranking entry.intReturns the rank position of the athlete in the challenge.doublegetScore()Returns the cumulative score achieved by the athlete.voidsetAthlete(Athlete athlete) Sets the athlete associated with this ranking.voidsetChallenge(Challenge challenge) Sets the challenge to which this ranking belongs.voidsetRankPosition(int rankPosition) Sets the rank position of the athlete.voidsetScore(double score) Sets the cumulative score achieved by the athlete.
-
Constructor Details
-
ChallengeRanking
public ChallengeRanking()
-
-
Method Details
-
getId
public int getId()Returns the unique identifier of this ranking entry.- Returns:
- the database identifier
-
getRankPosition
public int getRankPosition()Returns the rank position of the athlete in the challenge.- Returns:
- the rank position (1-based)
-
setRankPosition
public void setRankPosition(int rankPosition) Sets the rank position of the athlete.- Parameters:
rankPosition- the rank position to assign (1-based)
-
getScore
public double getScore()Returns the cumulative score achieved by the athlete.- Returns:
- the score value
-
setScore
public void setScore(double score) Sets the cumulative score achieved by the athlete.- Parameters:
score- the score value to assign
-
getChallenge
Returns the challenge to which this ranking belongs.- Returns:
- the parent
Challenge
-
setChallenge
Sets the challenge to which this ranking belongs.- Parameters:
challenge- the parentChallengeto assign
-
getAthlete
Returns the athlete associated with this ranking.- Returns:
- the ranked
Athlete
-
setAthlete
Sets the athlete associated with this ranking.- Parameters:
athlete- theAthleteto assign
-
getDisplayName
Returns the display name of the ranked athlete. Falls back to the username or email if the full name is unavailable, and ultimately returns "Inconnu" if no athlete is associated.- Returns:
- the athlete's display name
-
getFormattedScore
Returns the score formatted for display in the French locale. Integer scores are shown without decimal places; non-integer scores are shown with two decimal places. HandlesNaNand infinite values by returning "0".- Returns:
- the formatted score string
-