Skip to content

(Task 3) Feature: Race Status field - #3

Open
Cuttsy27 wants to merge 2 commits into
feature/order-races-by-advertised-start-timefrom
feature/race-status-field
Open

Cuttsy27 wants to merge 2 commits into
feature/order-races-by-advertised-start-timefrom
feature/race-status-field

Conversation

@Cuttsy27

@Cuttsy27 Cuttsy27 commented Aug 3, 2025

Copy link
Copy Markdown
Owner

Changes

  • added Status enum to Race message
  • added addStatusToRace/s methods to race repo
  • added timestamp utility functions
  • added tests for all

Summary

Races should have a Status field which is derived from their advertised_start_time property. A race in the past has status "CLOSED" and a race in the future has status "OPEN". As the Status is derived from the advertised_start_time, there are no DB changes to be made. When races are retrieved from the database, we iterate over the result and update the Status property of each race by comparing the current time to the advertised_start_time.

Example

curl -X "POST" "http://localhost:8000/v1/list-races" \
     -H 'Content-Type: application/json'
{
    "races":[
        {
            "id":"1",
            "meetingId":"5",
            "name":"North Dakota foes",
            "number":"2",
            "visible":false,
            "advertisedStartTime":"2021-03-03T01:30:57Z",
            "status":"CLOSED"
        }
    ]
}

Tests

  • We added tests for the new addStatusToRace and addStatusToRaces methods with 100% coverage
  • We added tests for each of the new utility functions IsProtoTimestampInPast, GetCurrentProtoTimestamp, GetProtoTimestamp, with 100% coverage
  • We tested the racing service to ensure it correctly handles races with the new Status property.

…StatusToRace/s methods to race repo. added timestamp util functions. added tests for all
@Cuttsy27 Cuttsy27 changed the title Feature: Race Status Field Feature: Race Status field Aug 4, 2025
@Cuttsy27 Cuttsy27 changed the title Feature: Race Status field (Task 3) Feature: Race Status field Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant