fix counter
This commit is contained in:
parent
13433c2972
commit
bf34abf5f8
2 changed files with 6 additions and 7 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4"
|
||||
|
@ -28,8 +27,8 @@ var funcMap = template.FuncMap{
|
|||
"sub": sub,
|
||||
}
|
||||
|
||||
func sub(a, b int64) string {
|
||||
return strconv.FormatInt(a-b, 10)
|
||||
func sub(a, b int) int {
|
||||
return a - b
|
||||
}
|
||||
|
||||
var db *pgxpool.Pool
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
{{range $i, $c := .Counter}}
|
||||
<img class="counter-image" alt="{{$c}}" src="/static/counter/{{$c}}.gif">
|
||||
{{ $n := sub $l $i }}
|
||||
{{ if $n eq 4 }}
|
||||
{{ if eq $n 4 }}
|
||||
KB
|
||||
{{ else if $n eq 8 }}
|
||||
{{ else if eq $n 7 }}
|
||||
MB
|
||||
{{ else if $n eq 12 }}
|
||||
{{ else if eq $n 10 }}
|
||||
GB
|
||||
{{ else if $n eq 16 }}
|
||||
{{ else if eq $n 13 }}
|
||||
TB
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
Loading…
Add table
Reference in a new issue