/// <summary>
/// Gets the progress made by a user in the challenge.
/// </summary>
/// <param name="user">The user to evaluate.</param>
/// <returns>Minimum of the user's progress and the challenge's requirement
/// (for use in a progress bar).</returns>
public float GetProgress(User user)
{
if (user.ChallengeInitialValues.ContainsKey(this.ID))
{
float startingPoint = user.ChallengeInitialValues[this.ID];
return Math.Min(user.GetStatistic(this.StatisticBinding) - startingPoint,
this.Requirement);
}
else
{
//TODO: Throw an exception here?
return -1;
}
}