Skip to content

Commit e5e2b2f

Browse files
authored
Add more stats tables (#29730)
Add `Tags`, `Branches` and `CommitStatus` to monitor/stats
1 parent 171d3d9 commit e5e2b2f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

models/activities/statistic.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
asymkey_model "code.gitea.io/gitea/models/asymkey"
1010
"code.gitea.io/gitea/models/auth"
1111
"code.gitea.io/gitea/models/db"
12+
git_model "code.gitea.io/gitea/models/git"
1213
issues_model "code.gitea.io/gitea/models/issues"
1314
"code.gitea.io/gitea/models/organization"
1415
access_model "code.gitea.io/gitea/models/perm/access"
@@ -29,7 +30,8 @@ type Statistic struct {
2930
Mirror, Release, AuthSource, Webhook,
3031
Milestone, Label, HookTask,
3132
Team, UpdateTask, Project,
32-
ProjectBoard, Attachment int64
33+
ProjectBoard, Attachment,
34+
Branches, Tags, CommitStatus int64
3335
IssueByLabel []IssueByLabelCount
3436
IssueByRepository []IssueByRepositoryCount
3537
}
@@ -58,6 +60,9 @@ func GetStatistic(ctx context.Context) (stats Statistic) {
5860
stats.Counter.Watch, _ = e.Count(new(repo_model.Watch))
5961
stats.Counter.Star, _ = e.Count(new(repo_model.Star))
6062
stats.Counter.Access, _ = e.Count(new(access_model.Access))
63+
stats.Counter.Branches, _ = e.Count(new(git_model.Branch))
64+
stats.Counter.Tags, _ = e.Where("is_draft=?", false).Count(new(repo_model.Release))
65+
stats.Counter.CommitStatus, _ = e.Count(new(git_model.CommitStatus))
6166

6267
type IssueCount struct {
6368
Count int64

0 commit comments

Comments
 (0)