From 34f4af9ebf179dbb24a7da6091b4259d66a3c426 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 27 Mar 2014 16:31:32 -0400 Subject: Working on issue and install page --- models/issue.go | 6 ++++++ models/repo.go | 1 + 2 files changed, 7 insertions(+) (limited to 'models') diff --git a/models/issue.go b/models/issue.go index b05667c3..b30676e9 100644 --- a/models/issue.go +++ b/models/issue.go @@ -136,6 +136,12 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed, return issues, err } +// GetUserIssueCount returns the number of issues that were created by given user in repository. +func GetUserIssueCount(userId, repoId int64) int64 { + count, _ := orm.Where("poster_id=?", userId).And("repo_id=?", repoId).Count(new(Issue)) + return count +} + // UpdateIssue updates information of issue. func UpdateIssue(issue *Issue) error { _, err := orm.Id(issue.Id).AllCols().Update(issue) diff --git a/models/repo.go b/models/repo.go index e6d4639b..43d4aa73 100644 --- a/models/repo.go +++ b/models/repo.go @@ -84,6 +84,7 @@ type Repository struct { NumForks int NumIssues int NumClosedIssues int + NumOpenIssues int `xorm:"-"` IsPrivate bool IsBare bool Created time.Time `xorm:"created"` -- cgit v1.2.3