修复负值显示错误
改进页面显示
This commit is contained in:
liuyanxi975 2022-05-30 17:51:11 +08:00
parent 6c3dbb6acd
commit 1091b430c5
2 changed files with 4 additions and 1 deletions

View File

@ -150,6 +150,9 @@ var funcMap = template.FuncMap{
},
"Transleft": func(a, b float64) (n float64) {
n, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (100-(a/b)*100)), 64)
if n < 0 {
n = 0
}
return
},
"UintToFloat": func(a uint64) (n float64) {

View File

@ -69,7 +69,7 @@
<td class="ui center aligned">{{$stats.Min|bf}}</td>
<td class="ui center aligned">{{(index $stats.NextUpdate $innerId)|sft}}</td>
<td class="ui center aligned">{{$transfer|bf}}</td>
<td class="ui center aligned" style="padding: 14px 0px 0px 0px; position: relative;"><div class="thirteen wide column"><div class="ui progress fine"><div class="bar" style="transition-duration: 300ms; min-width: unset; background-color: rgb(10, 148, 242); width: {{Transleft (UintToFloat $transfer) (UintToFloat $stats.Max)}}% !important;"><small>{{Transleft (UintToFloat $transfer) (UintToFloat $stats.Max)}} %</small></div></div></div></td>
<td class="ui center aligned" style="padding: 14px 0px 0px 0px; position: relative;"><div class="thirteen wide column"><div class="ui progress fine"><div class="bar" style="transition-duration: 300ms; min-width: unset; background-color: rgb(10, 148, 242); width: {{Transleft (UintToFloat $transfer) (UintToFloat $stats.Max)}}% !important;"></div><small style="position: absolute; top: 4px; margin-left: -20px;">{{Transleft (UintToFloat $transfer) (UintToFloat $stats.Max)}} %</small></div></div></td>
</tr>
{{end}}
{{end}}