Fix tasks not exported

This commit is contained in:
kolaente 2021-09-08 18:40:43 +02:00
parent 07bda3eae3
commit 465f6d90ab
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -130,6 +130,8 @@ func exportListsAndTasks(s *xorm.Session, u *user.User, wr *zip.Writer) (err err
namespaceIDs := []int64{} namespaceIDs := []int64{}
namespaces := []*NamespaceWithListsAndTasks{} namespaces := []*NamespaceWithListsAndTasks{}
listMap := make(map[int64]*ListWithTasksAndBuckets)
listIDs := []int64{}
for _, n := range namspaces.([]*NamespaceWithLists) { for _, n := range namspaces.([]*NamespaceWithLists) {
if n.ID < 1 { if n.ID < 1 {
// Don't include filters // Don't include filters
@ -142,11 +144,14 @@ func exportListsAndTasks(s *xorm.Session, u *user.User, wr *zip.Writer) (err err
} }
for _, l := range n.Lists { for _, l := range n.Lists {
nn.Lists = append(nn.Lists, &ListWithTasksAndBuckets{ ll := &ListWithTasksAndBuckets{
List: *l, List: *l,
BackgroundFileID: l.BackgroundFileID, BackgroundFileID: l.BackgroundFileID,
Tasks: []*TaskWithComments{}, Tasks: []*TaskWithComments{},
}) }
nn.Lists = append(nn.Lists, ll)
listMap[l.ID] = ll
listIDs = append(listIDs, l.ID)
} }
namespaceIDs = append(namespaceIDs, n.ID) namespaceIDs = append(namespaceIDs, n.ID)
@ -171,15 +176,6 @@ func exportListsAndTasks(s *xorm.Session, u *user.User, wr *zip.Writer) (err err
return err return err
} }
listMap := make(map[int64]*ListWithTasksAndBuckets)
listIDs := []int64{}
for _, l := range lists {
listMap[l.ID] = &ListWithTasksAndBuckets{
List: *l,
}
listIDs = append(listIDs, l.ID)
}
taskMap := make(map[int64]*TaskWithComments, len(tasks)) taskMap := make(map[int64]*TaskWithComments, len(tasks))
for _, t := range tasks { for _, t := range tasks {
taskMap[t.ID] = &TaskWithComments{ taskMap[t.ID] = &TaskWithComments{