-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor track-related entities to use RaceTrack instead of Track #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduce simulation parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors track-related entities from a single Track enum to a more flexible RaceTrack class with simulation-specific support. The refactoring introduces a Simulation enum (ACC, LMU) and a RaceTracks registry pattern to enable support for multiple racing simulations.
Key changes:
- Replaced
Trackenum withRaceTrackclass andRaceTracksstatic registry - Introduced
Simulationenum to support multiple racing simulations (ACC and LMU) - Updated all track references throughout views, services, filters, and entities to use the new
RaceTrackAPI
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
entities/Track.java |
Removed enum - replaced by RaceTrack class |
entities/Simulation.java |
New enum defining supported simulations (ACC, LMU) |
entities/RaceTrack.java |
New class representing a race track with simulation-specific IDs |
entities/RaceTracks.java |
Static registry providing access to all race tracks |
entities/Session.java |
Updated to use RaceTrack instead of Track enum |
entities/json/kunos/acc/AccBop.java |
Renamed getTrack() to getRaceTrack() |
entities/comparator/BopComparator.java |
Simplified to use fluent comparator API with RaceTrack |
entities/record/LapByTrack.java |
Updated to use RaceTrack, removed factory method |
entities/record/LapsByTrack.java |
Updated to use RaceTrack, removed factory method |
entities/record/LapsByAccCar.java |
Removed factory method (unrelated cleanup) |
views/filter/grid/SessionFilter.java |
Renamed track field to raceTrack |
views/filter/grid/OverallLapTimesFilter.java |
Updated to use RaceTracks.getById() |
views/filter/grid/BopManagementFilter.java |
Updated to use RaceTracks.getById() |
views/filter/grid/GridFilter.java |
Removed generic type constraint from createComboBoxHeader |
views/SessionComponentFactory.java |
Updated to use RaceTracks.getById() for display |
views/MapView.java |
Updated variable names and iteration over RaceTracks |
views/LeaderboardSessionsView.java |
Updated grid column and filter to use RaceTrack |
views/LeaderboardOverallLapTimesView.java |
Updated grid column and filter to use RaceTrack |
views/LeaderboardOverallLapTimesDifferentiatedView.java |
Updated to use RaceTrack with simulation support |
views/LeaderboardDriverDetailView.java |
Updated lap grouping and grid to use RaceTrack |
views/EntrylistEditorView.java |
Updated grid column to use RaceTrack display name |
views/BopManagementView.java |
Comprehensive update to use RaceTrack throughout |
views/BopEditorView.java |
Updated ComboBox and validation to use RaceTrack |
views/BopDisplayView.java |
Added simulation parameter support, updated to use RaceTrack |
views/BaseView.java |
Added QUERY_PARAMETER_SIMULATION_ID constant, removed unused constant |
services/weather/WeatherService.java |
Updated to use RaceTrack for weather data storage |
services/bop/BopService.java |
Updated initialization to use RaceTracks registry |
controller/WeatherController.java |
Updated API to accept simulationId and trackId parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
simdesk-web/src/main/java/de/sustineo/simdesk/services/weather/WeatherService.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/views/BopEditorView.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/entities/RaceTracks.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/views/MapView.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/services/weather/WeatherService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 33 out of 33 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
simdesk-web/src/main/java/de/sustineo/simdesk/views/BopManagementView.java
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/views/BopDisplayView.java
Outdated
Show resolved
Hide resolved
simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java
Show resolved
Hide resolved
…View.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request refactors the way tracks are represented and accessed throughout the codebase, replacing the old
Trackenum with a more flexibleRaceTrackclass and aRaceTracksregistry. This change enables support for multiple simulations and improves extensibility. The update also touches several controllers and entity classes to use the new structure, and introduces a newSimulationenum to handle different racing simulations.Key changes include:
Track Representation and Registry
Trackenum with a newRaceTrackclass and aRaceTracksregistry, allowing tracks to be defined with global IDs, display names, coordinates, and simulation-specific IDs. This makes it easier to support multiple simulations and extend the track list in the future. (RaceTrack.java,RaceTracks.java) [1] [2]Trackenum and its associated methods, consolidating all track-related logic into the new classes. (Track.java)Simulation Support
Simulationenum to represent different racing simulations (e.g., ACC, LMU), which is now used throughout the codebase for track lookups and associations. (Simulation.java)Controller and Entity Updates
WeatherControllerto usetrackId(global) instead ofaccTrackId, and to fetch tracks viaRaceTracks.getById. Improved error handling for unknown tracks. (WeatherController.java) [1] [2] [3]Sessionentity to store asimulationIdand use the newRaceTrackstructure for track lookups. (Session.java) [1] [2]Sorting and Comparison
AccBopComparatorto sortBopentities using the newRaceTracksregistry and simulation-aware lookups. (AccBopComparator.java)This pull request refactors how tracks are represented and accessed in the codebase, generalizing the concept fromTrack(specific to ACC) to a more flexibleRaceTrackmodel that supports multiple simulations. It introduces new entities for simulations and racetracks, updates controller and session logic to use these, and removes the legacyTrackenum. These changes improve extensibility and maintainability, making it easier to support additional simulations beyond ACC.Track and Simulation Model Refactoring
RaceTrack,RaceTracks, andSimulationentities to provide a unified and extensible way to represent tracks across different simulations, replacing the previous ACC-specificTrackenum. ([[1]](https://github.com/fabieu/simdesk/pull/278/files#diff-ed15fb117d3100a4d39ab91ae6070cfe1c02608b8113dc4b5971e7eeac73e432R1-R26),[[2]](https://github.com/fabieu/simdesk/pull/278/files#diff-a40c315d9e8fab989c3d5c52466939a931b5839a95d69c50a2842b665762bf57R1-R343),[[3]](https://github.com/fabieu/simdesk/pull/278/files#diff-96e23c50eda6b3c11be7b5e5a380186cf4cbfccfc143f74c79da016f04a98ebeR1-R24))Trackenum and its associated methods, migrating all track-related logic to useRaceTrackandRaceTracks. ([simdesk-web/src/main/java/de/sustineo/simdesk/entities/Track.javaL1-L76](https://github.com/fabieu/simdesk/pull/278/files#diff-61262593194a6130c10e6426737ff9896aec4a0b494a74cab78a8a18668e134fL1-L76))Controller and API Changes
WeatherControllerendpoints to accept bothsimulationIdandtrackIdparameters instead of justaccTrackId, and refactored logic to fetch tracks using the newRaceTracks.getByIdmethod. ([[1]](https://github.com/fabieu/simdesk/pull/278/files#diff-76b68d37f58020c648b7a24c4e560c651e6e82454a99b22b2b4e50c7c96720f5L61-R70),[[2]](https://github.com/fabieu/simdesk/pull/278/files#diff-76b68d37f58020c648b7a24c4e560c651e6e82454a99b22b2b4e50c7c96720f5L85-R108),[[3]](https://github.com/fabieu/simdesk/pull/278/files#diff-76b68d37f58020c648b7a24c4e560c651e6e82454a99b22b2b4e50c7c96720f5L4-R6))Entity Updates
Sessionentity to include asimulationIdfield and useRaceTrackinstead ofTrackfor track lookups. ([[1]](https://github.com/fabieu/simdesk/pull/278/files#diff-3e91b5502c7571fa88ad325fa5cc9bed50c37976896de67e5c8c9661e3363c92R16),[[2]](https://github.com/fabieu/simdesk/pull/278/files#diff-3e91b5502c7571fa88ad325fa5cc9bed50c37976896de67e5c8c9661e3363c92L26-R28))Comparator Improvements
BopComparatorto use the newRaceTracksandSimulationentities for sorting by track display name, improving sorting logic and consistency. ([simdesk-web/src/main/java/de/sustineo/simdesk/entities/comparator/BopComparator.javaR3-R17](https://github.com/fabieu/simdesk/pull/278/files#diff-7bdd09b00697c017adfb91eb3ed7c5192c4224f5a34aee6f10cbc985c6502b02R3-R17))This pull request refactors the way tracks are represented and accessed throughout the codebase, replacing the previousTrackenum with a new, more flexibleRaceTrackclass and associated utilities. It introduces support for multiple simulations (such as ACC and LMU) and enables querying tracks by simulation and track ID. The changes also update controller, entity, and comparator logic to use the new track system.Track Representation Refactor:
Trackenum and related static methods, replacing it with the newRaceTrackclass and theRaceTracksregistry, which supports multiple simulations and provides flexible lookup and registration of tracks. (simdesk-web/src/main/java/de/sustineo/simdesk/entities/Track.java,simdesk-web/src/main/java/de/sustineo/simdesk/entities/RaceTrack.java,simdesk-web/src/main/java/de/sustineo/simdesk/entities/RaceTracks.java) [1] [2] [3]Simulationenum to represent supported simulation platforms and enable track lookup per simulation. (simdesk-web/src/main/java/de/sustineo/simdesk/entities/Simulation.java)Controller and Entity Updates:
WeatherControllerto acceptsimulationIdandtrackIdparameters instead of justaccTrackId, and to use the new track lookup logic, improving error handling and flexibility for future simulation support. (simdesk-web/src/main/java/de/sustineo/simdesk/controller/WeatherController.java) [1] [2] [3]Sessionentity to storesimulationIdand use the newRaceTracklookup instead of the oldTrackenum. (simdesk-web/src/main/java/de/sustineo/simdesk/entities/Session.java) [1] [2]Comparator Update:
BopComparatorto use the newRaceTrackdisplay name for sorting, ensuring consistent ordering across simulations. (simdesk-web/src/main/java/de/sustineo/simdesk/entities/comparator/BopComparator.java)