Kanban #393
|
@ -56,14 +56,6 @@ func getBucketByID(id int64) (b *Bucket, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a new bucket
|
|
||||||
func (b *Bucket) Create(a web.Auth) (err error) {
|
|
||||||
b.CreatedByID = a.GetID()
|
|
||||||
|
|
||||||
_, err = x.Insert(b)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadAll returns all buckets with their tasks for a certain list
|
// ReadAll returns all buckets with their tasks for a certain list
|
||||||
func (b *Bucket) ReadAll(auth web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) {
|
func (b *Bucket) ReadAll(auth web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) {
|
||||||
|
|
||||||
|
@ -101,17 +93,24 @@ func (b *Bucket) ReadAll(auth web.Auth, search string, page int, perPage int) (r
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Put all tasks in their buckets
|
||||||
|
// All tasks which are not associated to any bucket will have bucket id 0 which is the nil value for int64
|
||||||
|
// Since we created a bucked with that id at the beginning, all tasks should be in there.
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
bucketMap[task.BucketID].Tasks = append(bucketMap[task.BucketID].Tasks, task)
|
bucketMap[task.BucketID].Tasks = append(bucketMap[task.BucketID].Tasks, task)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put all tasks in their buckets
|
|
||||||
|
|
||||||
// Put all tasks which are not explicitly associated to a bucket into a pseudo bucket
|
|
||||||
|
|
||||||
return buckets, len(buckets), int64(len(buckets)), nil
|
return buckets, len(buckets), int64(len(buckets)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create creates a new bucket
|
||||||
|
func (b *Bucket) Create(a web.Auth) (err error) {
|
||||||
|
b.CreatedByID = a.GetID()
|
||||||
|
|
||||||
|
_, err = x.Insert(b)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Update Updates an existing bucket
|
// Update Updates an existing bucket
|
||||||
func (b *Bucket) Update() (err error) {
|
func (b *Bucket) Update() (err error) {
|
||||||
_, err = x.Where("id = ?", b.ID).Update(b)
|
_, err = x.Where("id = ?", b.ID).Update(b)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user