mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-17 05:00:04 +02:00
fix: correct SQL query for active issues
- The `OR` should be inside the `AND` condition to not 'bypass' the other conditions. - Added minimal unit test. - Regression from2675a24649
(cherry picked from commit0055fdbdc4
)
This commit is contained in:
parent
240fbc2661
commit
d5c6036c53
2 changed files with 31 additions and 2 deletions
|
@ -337,8 +337,7 @@ func newlyCreatedIssues(ctx context.Context, repoID int64, fromTime time.Time) *
|
|||
func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
|
||||
sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID).
|
||||
And("issue.is_pull = ?", false).
|
||||
And("issue.created_unix >= ?", fromTime.Unix()).
|
||||
Or("issue.closed_unix >= ?", fromTime.Unix())
|
||||
And("issue.created_unix >= ? OR issue.closed_unix >= ?", fromTime.Unix(), fromTime.Unix())
|
||||
|
||||
return sess
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue