Parcourir la source

Also group compiler stats

Jakob Borg il y a 9 ans
Parent
commit
f5b7e8addd
3 fichiers modifiés avec 20 ajouts et 6 suppressions
  1. 7 0
      cmd/ursrv/analytics.go
  2. 1 1
      cmd/ursrv/main.go
  3. 12 5
      static/index.html

+ 7 - 0
cmd/ursrv/analytics.go

@@ -138,3 +138,10 @@ func byPlatform(s string) string {
 	}
 	return s
 }
+
+func byCompiler(s string) string {
+	if strings.HasPrefix(s, "go1.") && len(s) >= 5 {
+		return s[:5]
+	}
+	return "Other"
+}

+ 1 - 1
cmd/ursrv/main.go

@@ -737,7 +737,7 @@ func getReport(db *sql.DB) map[string]interface{} {
 	r["categories"] = categories
 	r["versions"] = group(byVersion, analyticsFor(versions, 2000), 5)
 	r["platforms"] = group(byPlatform, analyticsFor(platforms, 2000), 5)
-	r["compilers"] = analyticsFor(compilers, 12)
+	r["compilers"] = group(byCompiler, analyticsFor(compilers, 2000), 3)
 	r["builders"] = analyticsFor(builders, 12)
 	r["features"] = featureList
 

+ 12 - 5
static/index.html

@@ -216,11 +216,18 @@ found in the LICENSE file.
           </thead>
           <tbody>
             {{range .compilers}}
-            <tr>
-              <td>{{.Key}}</td>
-              <td class="text-right">{{.Count}}</td>
-              <td class="text-right">{{.Percentage | printf "%.01f"}}%</td>
-            </tr>
+              <tr class="main">
+                <td>{{.Key}}</td>
+                <td class="text-right">{{.Count}}</td>
+                <td class="text-right">{{.Percentage | printf "%.01f"}}%</td>
+              </tr>
+              {{range .Items}}
+                <tr class="child">
+                  <td class="first">{{.Key}}</td>
+                  <td class="text-right">{{.Count}}</td>
+                  <td class="text-right">{{.Percentage | printf "%.01f"}}%</td>
+                </tr>
+              {{end}}
             {{end}}
           </tbody>
         </table>