Sort Order for tasks #110

Merged
konrad merged 62 commits from feature/sort-order into master 2019-12-07 14:30:52 +00:00
Owner

Description

Checklist

  • I added or improved tests
  • I pushed new or updated dependencies to the repo using go mod vendor
  • I added or improved docs for my feature
    • Swagger (including make do-the-swag)
    • Error codes
# Description # Checklist * [x] I added or improved tests * [x] I pushed new or updated dependencies to the repo using `go mod vendor` * [x] I added or improved docs for my feature * [x] Swagger (including `make do-the-swag`) * [x] Error codes
konrad reviewed 2019-12-03 22:02:05 +00:00
@ -257,0 +324,4 @@
// This is a descending sort, so we need to negate the comparator (i.e. switch the inputs).
if param.orderBy == "desc" {
oldComparator := comparator
Author
Owner

@shilch Why are you duplicating the comparator here?

@shilch Why are you duplicating the comparator here?
Collaborator

If I didn't you would end in an infinite recursive loop because comparator would call itself.

If I didn't you would end in an infinite recursive loop because comparator would call itself.
konrad reviewed 2019-12-03 22:04:45 +00:00
@ -257,0 +319,4 @@
for _, param := range by {
comparator, ok := comparators[param.sortBy]
if !ok {
// TODO: Handle case that a suitable comparator has not been found
Author
Owner

IMHO we could panic here, this is only an internal api. User validation input happens way earlier.

IMHO we could panic here, this is only an internal api. User validation input happens way earlier.
konrad reviewed 2019-12-03 22:24:14 +00:00
@ -37,0 +46,4 @@
sortProperty string
sortOrder bool
Author
Owner

Any special resons why this is a bool? I know there can only be two types of sort orders, but a bool here is IMHO a bit overkill since bool has nothing to do with sort order.

Any special resons why this is a bool? I know there can only be two types of sort orders, but a bool here is IMHO a bit overkill since bool has nothing to do with sort order.
Collaborator

What would you use instead? Note how it's not aliased but typed, i.e. you can not accidentally convert one to the other.

What would you use instead? Note how it's not aliased but typed, i.e. you can not accidentally convert one to the other.
Author
Owner

Makes sense, thanks for clarifying.

Makes sense, thanks for clarifying.
konrad closed this pull request 2019-12-07 14:30:52 +00:00
konrad deleted branch feature/sort-order 2019-12-07 14:30:56 +00:00
Collaborator

🎉

:tada:
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#110
No description provided.