INNER CODE UNIT · Go
capCount
Bharath-code/git-scope · internal/attention/score.go:21
func capCount(n int) int {
if n > countCap {
return countCap
}
if n < 0 {
return 0
}
return n
}
// SubScore ranks repos within a tier. It is not meaningful across tiers (tier is
// the primary key); Less applies tier first, then SubScore.
func SubScore(s model.RepoStatus, now time.Time) int {
score := weightAhead*capCount(s.Ahead) + weightBehd*capCount(s.Behind)
score += weightDirty * capCount(s.Staged+s.Unstaged+s.Untracked+s.Stashes+s.OtherBranchCommits)
if s.ScanError != "" {
score += weightErr
}