Chromium Code Reviews| 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"). |