updated so balls are coloured to their respective game. need to thing about set for life.

This commit is contained in:
2025-03-28 14:52:50 +00:00
parent cabc283673
commit 75d8d1700e
3 changed files with 113 additions and 65 deletions

View File

@@ -3,6 +3,7 @@ package helpers
import (
"html/template"
"net/http"
"strings"
"synlotto-website/models"
"github.com/gorilla/csrf"
@@ -31,7 +32,9 @@ func TemplateFuncs() template.FuncMap {
}
return *p
},
"inSlice": InSlice,
"inSlice": InSlice,
"lower": lower,
"rangeClass": rangeClass,
}
}
@@ -72,3 +75,24 @@ func InSlice(n int, list []int) bool {
return true
}
func lower(input string) string {
return strings.ToLower(input)
}
func rangeClass(n int) string {
switch {
case n >= 1 && n <= 9:
return "01-09"
case n >= 10 && n <= 19:
return "10-19"
case n >= 20 && n <= 29:
return "20-29"
case n >= 30 && n <= 39:
return "30-39"
case n >= 40 && n <= 49:
return "40-49"
default:
return "50-plus"
}
}