(Task 2) Feature: order races by advertised start time - #2
Open
Cuttsy27 wants to merge 3 commits into
Open
Conversation
…o pass order-by string to request. added applyOrder method to races repo
…od. added tests for applyOrderBy. added ordering tests for racing service
… advertised_start_time by default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Summary
A new order_by string property should be added to the ListRacesRequest protobuf message, which can be used by the application to determine if any sorting should be done to races before returning them to the client.
According to Google AIP 132, ordering should be specified by a comma-separated list of properties to order by, optionally followed by the direction e.g. "advertised_start_time desc, name". Ascending should be the default order and can be omitted from the string.
Races are ordered by advertised_start_time in ascending order by default, even when no order_by is specified.
To check the provided order_by string for valid properties to order by, we split the string by comma into a slice. A
Containsutility function was added to the codebase to help test if a given string exists in a slice of strings. We use this to compare each property in the order_by string to a predetermined list of valid fields. If the order_by property is not a valid field, we ignore it.Example
Tests