Skip to content

Commit c091c94

Browse files
committed
Fix test
1 parent cdb72ac commit c091c94

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

models/project/board.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ func (Board) TableName() string {
5858
return "project_board"
5959
}
6060

61+
// NumIssues return counter of all issues assigned to the board
62+
func (b *Board) NumIssues() int {
63+
c, err := db.GetEngine(db.DefaultContext).Table("project_issue").
64+
Where("project_board_id=?", b.ID).
65+
GroupBy("issue_id").
66+
Cols("issue_id").
67+
Count()
68+
if err != nil {
69+
return 0
70+
}
71+
return int(c)
72+
}
73+
6174
func init() {
6275
db.RegisterModel(new(Board))
6376
}

models/project/issue.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ func deleteProjectIssuesByProjectID(e db.Engine, projectID int64) error {
3030
return err
3131
}
3232

33-
// ____ _ _
34-
// | _ \ _ __ ___ (_) ___ ___| |_
35-
// | |_) | '__/ _ \| |/ _ \/ __| __|
36-
// | __/| | | (_) | | __/ (__| |_
37-
// |_| |_| \___// |\___|\___|\__|
38-
// |__/
39-
4033
// NumIssues return counter of all issues assigned to a project
4134
func (p *Project) NumIssues() int {
4235
c, err := db.GetEngine(db.DefaultContext).Table("project_issue").

templates/repo/projects/view.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<div class="board-column-header df ac sb">
8585
<div class="ui large label board-label py-2">
8686
<div class="ui small circular grey label board-card-cnt">
87-
{{len .Issues}}
87+
{{.NumIssues}}
8888
</div>
8989
{{.Title}}
9090
</div>

0 commit comments

Comments
 (0)