updated team stats

This commit is contained in:
2026-03-06 19:06:29 +11:00
parent c53fbac281
commit fc219a044c
5 changed files with 230 additions and 125 deletions

View File

@@ -49,7 +49,7 @@ templ teamSeasonCard(team *db.Team, info *db.TeamSeasonInfo) {
<div class="flex items-center gap-1.5">
<span class="text-xs text-subtext0 uppercase font-medium">Position</span>
<span class="text-2xl font-bold text-text">
{ fmt.Sprint(info.Position) }
{ ordinal(info.Position) }
</span>
<span class="text-sm text-subtext0">
/ { fmt.Sprint(info.TotalTeams) }
@@ -84,3 +84,20 @@ templ teamSeasonCard(team *db.Team, info *db.TeamSeasonInfo) {
</div>
</a>
}
func ordinal(n int) string {
suffix := "th"
if n%100 >= 11 && n%100 <= 13 {
// 11th, 12th, 13th
} else {
switch n % 10 {
case 1:
suffix = "st"
case 2:
suffix = "nd"
case 3:
suffix = "rd"
}
}
return fmt.Sprintf("%d%s", n, suffix)
}