Sort qualified beatmap listing according to qualified queue date #3154
Conversation
@@ -68,15 +68,15 @@ public function __construct(Request $request, ?User $user = null) | |||
} | |||
|
|||
$sort = explode('_', $request['sort']); | |||
$this->sort = static::normalizeSort( | |||
$this->sort = $this->normalizeSort( |
nanaya
May 18, 2018
•
Collaborator
Not related with this pull request but this assignment and related functions seem a bit... interesting.
- first it create sort with given params
- and then the created sort is thrown out, replaced with another pretty much the same sort just the
sort[0]
mapped to correct field
- it's put in array
- the
normalizeSort
function loops the array which is always single element.
- (kind of related to this pull request) goes to great length using
array_unshift
instead of just doing it before appending with provided sort
- it prepends the return sort, potentially overriding any previous sorts (
['artist', 'approved_date']
→ ['queued_at', 'artist', 'approved_date']
)
- except it doesn't matter because there's always only one sort
Not related with this pull request but this assignment and related functions seem a bit... interesting.
- first it create sort with given params
- and then the created sort is thrown out, replaced with another pretty much the same sort just the
sort[0]
mapped to correct field - it's put in array
- the
normalizeSort
function loops the array which is always single element. - (kind of related to this pull request) goes to great length using
array_unshift
instead of just doing it before appending with provided sort- it prepends the return sort, potentially overriding any previous sorts (
['artist', 'approved_date']
→['queued_at', 'artist', 'approved_date']
) - except it doesn't matter because there's always only one sort
- it prepends the return sort, potentially overriding any previous sorts (
notbakaneko
May 18, 2018
Author
Collaborator
probably should have added a comment there >_>
probably should have added a comment there >_>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
fixes #3072
Maps that are not in the queue will be ordered below those that are, regardless of sort direction.
index mapping should be updated first so that the query doesn't die while the field doesn't exist
curl -XPUT -H "Content-Type: application/json" http://ES_HOST/beatmaps/_mapping/beatmaps -d '{ "properties": { "queued_at": { "type": "date" } } }'