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"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang-migrate/migrate/v4"
|
"github.com/golang-migrate/migrate/v4"
|
||||||
|
@ -28,8 +27,8 @@ var funcMap = template.FuncMap{
|
||||||
"sub": sub,
|
"sub": sub,
|
||||||
}
|
}
|
||||||
|
|
||||||
func sub(a, b int64) string {
|
func sub(a, b int) int {
|
||||||
return strconv.FormatInt(a-b, 10)
|
return a - b
|
||||||
}
|
}
|
||||||
|
|
||||||
var db *pgxpool.Pool
|
var db *pgxpool.Pool
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
{{range $i, $c := .Counter}}
|
{{range $i, $c := .Counter}}
|
||||||
<img class="counter-image" alt="{{$c}}" src="/static/counter/{{$c}}.gif">
|
<img class="counter-image" alt="{{$c}}" src="/static/counter/{{$c}}.gif">
|
||||||
{{ $n := sub $l $i }}
|
{{ $n := sub $l $i }}
|
||||||
{{ if $n eq 4 }}
|
{{ if eq $n 4 }}
|
||||||
KB
|
KB
|
||||||
{{ else if $n eq 8 }}
|
{{ else if eq $n 7 }}
|
||||||
MB
|
MB
|
||||||
{{ else if $n eq 12 }}
|
{{ else if eq $n 10 }}
|
||||||
GB
|
GB
|
||||||
{{ else if $n eq 16 }}
|
{{ else if eq $n 13 }}
|
||||||
TB
|
TB
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue