Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Unified Diff: milo/appengine/common/funcs.go

Issue 2931773004: Milo: Add machine pool info for buildbot builder view. (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: milo/appengine/common/funcs.go
diff --git a/milo/appengine/common/funcs.go b/milo/appengine/common/funcs.go
index 805ebeadc536ed3b63c0c54e330fbee212f13998..38fe50267ddd9d8d9b27aa4650ec4689f71f3344 100644
--- a/milo/appengine/common/funcs.go
+++ b/milo/appengine/common/funcs.go
@@ -31,6 +31,7 @@ var funcMap = template.FuncMap{
"consoleHeader": consoleHeader,
"pagedURL": pagedURL,
"formatTime": formatTime,
+ "percent": percent,
}
// localTime returns a <span> element with t in human format
@@ -245,6 +246,12 @@ func pagedURL(r *http.Request, limit int, cursor string) string {
return result.String()
}
+// percent divides two numbers and returns the percentage in string form.
nodir 2017/06/13 02:38:40 i think it divides one number
Ryan Tseng 2017/06/13 23:10:33 Done.
+func percent(numerator, divisor int) string {
+ p := float64(numerator) * 100.0 / float64(divisor)
+ return fmt.Sprintf("%.1f", p)
+}
+
func init() {
linkifySetTemplate = template.Must(
template.New("linkifySet").

Powered by Google App Engine
This is Rietveld 408576698