|
|
|
@ -272,7 +272,8 @@ type Statistic struct { |
|
|
|
|
Counter struct { |
|
|
|
|
User, Org, PublicKey, |
|
|
|
|
Repo, Watch, Star, Action, Access, |
|
|
|
|
Issue, Comment, Oauth, Follow, |
|
|
|
|
Issue, IssueClosed, IssueOpen, |
|
|
|
|
Comment, Oauth, Follow, |
|
|
|
|
Mirror, Release, LoginSource, Webhook, |
|
|
|
|
Milestone, Label, HookTask, |
|
|
|
|
Team, UpdateTask, Attachment int64 |
|
|
|
@ -289,7 +290,24 @@ func GetStatistic() (stats Statistic) { |
|
|
|
|
stats.Counter.Star, _ = x.Count(new(Star)) |
|
|
|
|
stats.Counter.Action, _ = x.Count(new(Action)) |
|
|
|
|
stats.Counter.Access, _ = x.Count(new(Access)) |
|
|
|
|
stats.Counter.Issue, _ = x.Count(new(Issue)) |
|
|
|
|
|
|
|
|
|
type IssueCount struct { |
|
|
|
|
Count int64 |
|
|
|
|
IsClosed bool |
|
|
|
|
} |
|
|
|
|
issueCounts := []IssueCount{} |
|
|
|
|
|
|
|
|
|
_ = x.Select("COUNT(*) AS count, is_closed").Table("issue").GroupBy("is_closed").Find(&issueCounts) |
|
|
|
|
for _, c := range issueCounts { |
|
|
|
|
if c.IsClosed { |
|
|
|
|
stats.Counter.IssueClosed = c.Count |
|
|
|
|
} else { |
|
|
|
|
stats.Counter.IssueOpen = c.Count |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
stats.Counter.Issue = stats.Counter.IssueClosed + stats.Counter.IssueOpen |
|
|
|
|
|
|
|
|
|
stats.Counter.Comment, _ = x.Count(new(Comment)) |
|
|
|
|
stats.Counter.Oauth = 0 |
|
|
|
|
stats.Counter.Follow, _ = x.Count(new(Follow)) |
|
|
|
|