Fix issue with session list
It fixes issue of sorting and pagination for the status column due to Its stringify interpretation.
This commit is contained in:
@@ -67,6 +67,14 @@ func (ctrl Session) List(ctx context.Context, r *request.SessionList) (interface
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// fixes issue with sorting of status column and pagination
|
||||
// need to improve on cursor for this
|
||||
if f.Paging.PageCursor != nil {
|
||||
for _, status := range r.Status {
|
||||
f.Paging.PageCursor.Set("status", status, false)
|
||||
}
|
||||
}
|
||||
|
||||
f.IncTotal = r.IncTotal
|
||||
|
||||
if f.Sorting, err = filter.NewSorting(r.Sort); err != nil {
|
||||
|
||||
@@ -252,7 +252,7 @@ func (p *PagingCursor) UnmarshalJSON(in []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(in, &aux); err != nil {
|
||||
if err = json.Unmarshal(in, &aux); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -287,10 +287,10 @@ func (p *PagingCursor) Decode(cursor string) error {
|
||||
}
|
||||
|
||||
// Sort returns:
|
||||
// - sort if cursor is nil
|
||||
// - sort from cursor when sort is empty
|
||||
// - sort from cursor when sort is compatible with cursor
|
||||
// - error if sort & cursor are incompatible
|
||||
// - sort if cursor is nil
|
||||
// - sort from cursor when sort is empty
|
||||
// - sort from cursor when sort is compatible with cursor
|
||||
// - error if sort & cursor are incompatible
|
||||
func (p *PagingCursor) Sort(sort SortExprSet) (SortExprSet, error) {
|
||||
if p == nil {
|
||||
return sort, nil
|
||||
|
||||
Reference in New Issue
Block a user