summaryrefslogtreecommitdiffstats
path: root/routers/repo/activity.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/activity.go')
-rw-r--r--routers/repo/activity.go28
1 files changed, 4 insertions, 24 deletions
diff --git a/routers/repo/activity.go b/routers/repo/activity.go
index 564537c1fd..fbe51e152e 100644
--- a/routers/repo/activity.go
+++ b/routers/repo/activity.go
@@ -43,34 +43,14 @@ func Activity(ctx *context.Context) {
ctx.Data["DateUntil"] = timeUntil.Format("January 2, 2006")
ctx.Data["PeriodText"] = ctx.Tr("repo.activity.period." + ctx.Data["Period"].(string))
- stats := &models.ActivityStats{}
-
- if ctx.Repo.Repository.UnitEnabled(models.UnitTypeReleases) {
- if err := models.FillReleasesForActivity(stats, ctx.Repo.Repository.ID, timeFrom); err != nil {
- ctx.Handle(500, "FillReleasesForActivity", err)
- return
- }
- }
- if ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
- if err := models.FillPullRequestsForActivity(stats, ctx.Repo.Repository.ID, timeFrom); err != nil {
- ctx.Handle(500, "FillPullRequestsForActivity", err)
- return
- }
- }
- if ctx.Repo.Repository.UnitEnabled(models.UnitTypeIssues) {
- if err := models.FillIssuesForActivity(stats, ctx.Repo.Repository.ID, timeFrom); err != nil {
- ctx.Handle(500, "FillIssuesForActivity", err)
- return
- }
- }
- if err := models.FillUnresolvedIssuesForActivity(stats, ctx.Repo.Repository.ID, timeFrom,
+ var err error
+ if ctx.Data["Activity"], err = models.GetActivityStats(ctx.Repo.Repository.ID, timeFrom,
+ ctx.Repo.Repository.UnitEnabled(models.UnitTypeReleases),
ctx.Repo.Repository.UnitEnabled(models.UnitTypeIssues),
ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests)); err != nil {
- ctx.Handle(500, "FillUnresolvedIssuesForActivity", err)
+ ctx.Handle(500, "GetActivityStats", err)
return
}
- ctx.Data["Activity"] = stats
-
ctx.HTML(200, tplActivity)
}