Create a new API endpoint called streak, which calculates user win or losing streak
Request
api("/league/streak" methods=["GET"])
Response
{
TeamName: {
Streak: signedInteger
},
}
A Positive streak indicates wins, a negative streak indicates losses
Calculation
if streak > 0 and current_week was a loss || streak < 0 and current_week was a win
streak = 0
if streak > 0 and current_weel was a win
streak++
if streak < 0 and current_week was a loss
streak--
Potentially store streaks in database or calculate live (live calculation is expensive)
Create a new API endpoint called streak, which calculates user win or losing streak
Request api("/league/streak" methods=["GET"])
Response { TeamName: { Streak: signedInteger }, }
A Positive streak indicates wins, a negative streak indicates losses Calculation if streak > 0 and current_week was a loss || streak < 0 and current_week was a win streak = 0 if streak > 0 and current_weel was a win streak++ if streak < 0 and current_week was a loss streak--
Potentially store streaks in database or calculate live (live calculation is expensive)