Fix getting all buckets
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
9c9cbca11a
commit
b82d0af1ac
|
@ -144,10 +144,11 @@ func (b *Bucket) ReadAll(s *xorm.Session, auth web.Auth, search string, page int
|
|||
opts.page = page
|
||||
opts.perPage = perPage
|
||||
opts.search = search
|
||||
opts.filterConcat = filterConcatAnd
|
||||
|
||||
var bucketFilterIndex int
|
||||
for i, filter := range opts.filters {
|
||||
if filter.field == "bucket_id" {
|
||||
if filter.field == taskPropertyBucketID {
|
||||
bucketFilterIndex = i
|
||||
break
|
||||
}
|
||||
|
@ -155,7 +156,7 @@ func (b *Bucket) ReadAll(s *xorm.Session, auth web.Auth, search string, page int
|
|||
|
||||
if bucketFilterIndex == 0 {
|
||||
opts.filters = append(opts.filters, &taskFilter{
|
||||
field: "bucket_id",
|
||||
field: taskPropertyBucketID,
|
||||
value: 0,
|
||||
comparator: taskFilterComparatorEquals,
|
||||
})
|
||||
|
|
|
@ -82,7 +82,7 @@ func TestBucket_ReadAll(t *testing.T) {
|
|||
FilterValue: []string{"done"},
|
||||
},
|
||||
}
|
||||
bucketsInterface, _, _, err := b.ReadAll(s, testuser, "", 0, 0)
|
||||
bucketsInterface, _, _, err := b.ReadAll(s, testuser, "", -1, 0)
|
||||
assert.NoError(t, err)
|
||||
|
||||
buckets := bucketsInterface.([]*Bucket)
|
||||
|
|
|
@ -72,7 +72,8 @@ func validateTaskField(fieldName string) error {
|
|||
taskPropertyUID,
|
||||
taskPropertyCreated,
|
||||
taskPropertyUpdated,
|
||||
taskPropertyPosition:
|
||||
taskPropertyPosition,
|
||||
taskPropertyBucketID:
|
||||
return nil
|
||||
}
|
||||
return ErrInvalidTaskField{TaskField: fieldName}
|
||||
|
|
|
@ -44,6 +44,7 @@ const (
|
|||
taskPropertyCreated string = "created"
|
||||
taskPropertyUpdated string = "updated"
|
||||
taskPropertyPosition string = "position"
|
||||
taskPropertyBucketID string = "bucket_id"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
Loading…
Reference in New Issue