diff --git a/cmd/ursrv/main.go b/cmd/ursrv/main.go index 1dfe92fd0..1f530afcf 100644 --- a/cmd/ursrv/main.go +++ b/cmd/ursrv/main.go @@ -693,11 +693,14 @@ func getReport(db *sql.DB) map[string]interface{} { featureNames = append(featureNames, key) } sort.Strings(featureNames) - for _, key := range featureNames { - featureList = append(featureList, feature{ - Key: key, - Pct: (100 * features[key]) / v2Reports, - }) + if v2Reports > 0 { + for _, key := range featureNames { + featureList = append(featureList, feature{ + Key: key, + Pct: (100 * features[key]) / v2Reports, + }) + } + sort.Sort(sort.Reverse(sortableFeatureList(featureList))) } r := make(map[string]interface{}) @@ -881,3 +884,15 @@ func getMovement(db *sql.DB) ([][]interface{}, error) { return res, nil } + +type sortableFeatureList []feature + +func (l sortableFeatureList) Len() int { + return len(l) +} +func (l sortableFeatureList) Swap(a, b int) { + l[a], l[b] = l[b], l[a] +} +func (l sortableFeatureList) Less(a, b int) bool { + return l[a].Pct < l[b].Pct +} diff --git a/static/index.html b/static/index.html index 7e2909a3a..d0b84fe35 100644 --- a/static/index.html +++ b/static/index.html @@ -100,13 +100,13 @@ found in the LICENSE file.

Syncthing Usage Data

-

Active Users per Day and Version

+

Active Users per Day and Version

This is the total number of unique users with reporting enabled, per day. Area color represents the major version.

-

Users Joining and Leaving per Day

+

Users Joining and Leaving per Day

This is the total number of unique users joining and leaving per day. A user is counted as "joined" on first the day their unique ID is seen, and as "left" on the last day the unique ID was seen before a two weeks or longer absence. "Bounced" refers to users who joined and left on the same day.

@@ -116,7 +116,7 @@ found in the LICENSE file. Spikes in December 2014 were due to the unique ID format changing and have been partly removed to avoid skewing the graph scale.

-

Usage Metrics

+

Usage Metrics

This is the aggregated usage report data for the last 24 hours. Data based on {{.nodes}} devices that have reported in.

@@ -246,7 +246,7 @@ found in the LICENSE file.
-

Feature Usage

+

Feature Usage

The following lists feature usage, as a percentage of the v0.12+ population ({{.v2nodes}} devices).