From 460cb52a5b986310883838d3d2cbeb05b1202a57 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 29 Mar 2022 19:40:21 +0800 Subject: [PATCH] Improve codes --- models/project/board.go | 3 ++- models/project/project.go | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/models/project/board.go b/models/project/board.go index 773568c6dd460..f770a18f59e01 100644 --- a/models/project/board.go +++ b/models/project/board.go @@ -61,7 +61,8 @@ func (Board) TableName() string { // NumIssues return counter of all issues assigned to the board func (b *Board) NumIssues() int { c, err := db.GetEngine(db.DefaultContext).Table("project_issue"). - Where("project_board_id=?", b.ID). + Where("project_id=?", b.ProjectID). + And("project_board_id=?", b.ID). GroupBy("issue_id"). Cols("issue_id"). Count() diff --git a/models/project/project.go b/models/project/project.go index 8ebf87b179449..a639879e78a2c 100644 --- a/models/project/project.go +++ b/models/project/project.go @@ -39,13 +39,6 @@ const ( TypeOrganization ) -// __________ __ __ -// \______ \_______ ____ |__| ____ _____/ |_ ______ -// | ___/\_ __ \/ _ \ | |/ __ \_/ ___\ __\/ ___/ -// | | | | \( <_> ) | \ ___/\ \___| | \___ \ -// |____| |__| \____/\__| |\___ >\___ >__| /____ > -// \______| \/ \/ \/ - // ErrProjectNotExist represents a "ProjectNotExist" kind of error. type ErrProjectNotExist struct { ID int64