diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-03-12 12:21:09 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-03-20 08:46:28 +0100 |
commit | 926367fe1d778fe7c9f5bc6b8e8c514b619ef038 (patch) | |
tree | 449440368b2c5f3ea71aff2796283dc6a12d37a2 /models | |
parent | Use Get but not Post to get actions artifacts (#29734) (diff) | |
download | forgejo-926367fe1d778fe7c9f5bc6b8e8c514b619ef038.tar.xz forgejo-926367fe1d778fe7c9f5bc6b8e8c514b619ef038.zip |
Add more stats tables (#29730)
Add `Tags`, `Branches` and `CommitStatus` to monitor/stats
(cherry picked from commit e5e2b2fcd7e8446f99e8eb61eef9efe2790220c8)
Diffstat (limited to 'models')
-rw-r--r-- | models/activities/statistic.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/models/activities/statistic.go b/models/activities/statistic.go index fe5f7d0872..d1a459d1b2 100644 --- a/models/activities/statistic.go +++ b/models/activities/statistic.go @@ -9,6 +9,7 @@ import ( asymkey_model "code.gitea.io/gitea/models/asymkey" "code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/models/db" + git_model "code.gitea.io/gitea/models/git" issues_model "code.gitea.io/gitea/models/issues" "code.gitea.io/gitea/models/organization" access_model "code.gitea.io/gitea/models/perm/access" @@ -29,7 +30,8 @@ type Statistic struct { Mirror, Release, AuthSource, Webhook, Milestone, Label, HookTask, Team, UpdateTask, Project, - ProjectBoard, Attachment int64 + ProjectBoard, Attachment, + Branches, Tags, CommitStatus int64 IssueByLabel []IssueByLabelCount IssueByRepository []IssueByRepositoryCount } @@ -58,6 +60,9 @@ func GetStatistic(ctx context.Context) (stats Statistic) { stats.Counter.Watch, _ = e.Count(new(repo_model.Watch)) stats.Counter.Star, _ = e.Count(new(repo_model.Star)) stats.Counter.Access, _ = e.Count(new(access_model.Access)) + stats.Counter.Branches, _ = e.Count(new(git_model.Branch)) + stats.Counter.Tags, _ = e.Where("is_draft=?", false).Count(new(repo_model.Release)) + stats.Counter.CommitStatus, _ = e.Count(new(git_model.CommitStatus)) type IssueCount struct { Count int64 |