mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: use active users instead of total users in Template views (#3900)
This commit is contained in:
+17
@@ -2,6 +2,7 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -175,3 +176,19 @@ func parseTime(s string) (time.Time, error) {
|
||||
}
|
||||
return time.Time{}, errInvalidTimeFormat
|
||||
}
|
||||
|
||||
func formatActiveDevelopers(n int) string {
|
||||
developerText := "developer"
|
||||
if n != 1 {
|
||||
developerText = "developers"
|
||||
}
|
||||
|
||||
var nStr string
|
||||
if n < 0 {
|
||||
nStr = "-"
|
||||
} else {
|
||||
nStr = strconv.Itoa(n)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s active %s", nStr, developerText)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user