aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorjaqra <48099350+jaqra@users.noreply.github.com>2019-11-07 21:09:51 +0300
committerLauris BH <lauris@nix.lv>2019-11-07 20:09:51 +0200
commit065bbddab91791666ef1d0e10765f58595094a1e (patch)
tree2c6aa684fc738d5d0111176ad42480bb5bc9fb1e /routers/repo
parent1f90147f3942065e2a7f564e8a3c97d23d41e6c0 (diff)
downloadgitea-065bbddab91791666ef1d0e10765f58595094a1e.tar.gz
gitea-065bbddab91791666ef1d0e10765f58595094a1e.zip
Fix count for commit graph last page (#8843)
* Fix count for commit graph last page * Remove used once variable * Move func to model * capitalize method name * fix error message
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/commit.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 550e4c3a9c..f067729ca9 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -91,6 +91,12 @@ func Graph(ctx *context.Context) {
return
}
+ allCommitsCount, err := ctx.Repo.GitRepo.GetAllCommitsCount()
+ if err != nil {
+ ctx.ServerError("GetAllCommitsCount", err)
+ return
+ }
+
page := ctx.QueryInt("page")
graph, err := models.GetCommitGraph(ctx.Repo.GitRepo, page)
@@ -105,7 +111,7 @@ func Graph(ctx *context.Context) {
ctx.Data["CommitCount"] = commitsCount
ctx.Data["Branch"] = ctx.Repo.BranchName
ctx.Data["RequireGitGraph"] = true
- ctx.Data["Page"] = context.NewPagination(int(commitsCount), setting.UI.GraphMaxCommitNum, page, 5)
+ ctx.Data["Page"] = context.NewPagination(int(allCommitsCount), setting.UI.GraphMaxCommitNum, page, 5)
ctx.HTML(200, tplGraph)
}