fix: fetch all tasks for all projects

This commit is contained in:
kolaente 2023-04-03 15:36:20 +02:00
parent 3b0935d033
commit 353279cbff
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 3 additions and 7 deletions

View File

@ -10,9 +10,6 @@
- entity_id: 34 - entity_id: 34
user_id: 13 # owner user_id: 13 # owner
kind: 1 kind: 1
- entity_id: 34
user_id: 1
kind: 1
- entity_id: 23 - entity_id: 23
user_id: 12 # owner user_id: 12 # owner
kind: 2 kind: 2

View File

@ -401,10 +401,9 @@ func getRawTasksForProjects(s *xorm.Session, projects []*Project, a web.Auth, op
} }
var projectIDCond builder.Cond var projectIDCond builder.Cond
var projectCond builder.Cond var favoritesCond builder.Cond
if len(projectIDs) > 0 { if len(projectIDs) > 0 {
projectIDCond = builder.In("project_id", projectIDs) projectIDCond = builder.In("project_id", projectIDs)
projectCond = projectIDCond
} }
if hasFavoritesProject { if hasFavoritesProject {
@ -435,7 +434,7 @@ func getRawTasksForProjects(s *xorm.Session, projects []*Project, a web.Auth, op
builder.Eq{"kind": FavoriteKindTask}, builder.Eq{"kind": FavoriteKindTask},
)) ))
projectCond = builder.And(projectCond, builder.And(builder.In("id", favCond), builder.In("project_id", userProjectIDs))) favoritesCond = builder.In("id", favCond)
} }
if len(reminderFilters) > 0 { if len(reminderFilters) > 0 {
@ -486,7 +485,7 @@ func getRawTasksForProjects(s *xorm.Session, projects []*Project, a web.Auth, op
} }
limit, start := getLimitFromPageIndex(opts.page, opts.perPage) limit, start := getLimitFromPageIndex(opts.page, opts.perPage)
cond := builder.And(projectCond, where, filterCond) cond := builder.And(builder.Or(projectIDCond, favoritesCond), where, filterCond)
query := s.Where(cond) query := s.Where(cond)
if limit > 0 { if limit > 0 {