updated so balls are coloured to their respective game. need to thing about set for life.
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user