mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Less rounding in feature list
This commit is contained in:
parent
f5b7e8addd
commit
6e960f1972
@ -468,7 +468,7 @@ type category struct {
|
||||
|
||||
type feature struct {
|
||||
Key string
|
||||
Pct int
|
||||
Pct float64
|
||||
}
|
||||
|
||||
func getReport(db *sql.DB) map[string]interface{} {
|
||||
@ -488,7 +488,7 @@ func getReport(db *sql.DB) map[string]interface{} {
|
||||
var builders []string
|
||||
|
||||
v2Reports := 0
|
||||
features := map[string]int{
|
||||
features := map[string]float64{
|
||||
"Rate limiting": 0,
|
||||
"Upgrades allowed (automatic)": 0,
|
||||
"Upgrades allowed (manual)": 0,
|
||||
@ -725,7 +725,7 @@ func getReport(db *sql.DB) map[string]interface{} {
|
||||
for _, key := range featureNames {
|
||||
featureList = append(featureList, feature{
|
||||
Key: key,
|
||||
Pct: (100 * features[key]) / v2Reports,
|
||||
Pct: (100 * features[key]) / float64(v2Reports),
|
||||
})
|
||||
}
|
||||
sort.Sort(sort.Reverse(sortableFeatureList(featureList)))
|
||||
|
@ -266,9 +266,9 @@ found in the LICENSE file.
|
||||
{{range .features}}
|
||||
<tr>
|
||||
<td style="width: 30%">{{.Key}}</td>
|
||||
<td style="width: 10%" class="text-right">{{.Pct}}%</td>
|
||||
<td style="width: 10%" class="text-right">{{if ge .Pct 10.0}}{{.Pct | printf "%.0f"}}{{else if ge .Pct 1.0}}{{.Pct | printf "%.01f"}}{{else}}{{.Pct | printf "%.02f"}}{{end}}%</td>
|
||||
<td style="width: 60%">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{{.Pct}}" aria-valuemin="0" aria-valuemax="100" style="width: {{.Pct}}%; height:20px"></div>
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{{.Pct | printf "%.02f"}}" aria-valuemin="0" aria-valuemax="100" style="width: {{.Pct | printf "%.02f"}}%; height:20px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user