Conversation
|
TODO: |
…ordon-360-api into s24-recim-bracket-v2
Gordon360/Models/ViewModels/RecIM/TeamBracketExportViewModel.cs
Outdated
Show resolved
Hide resolved
russtuck
left a comment
There was a problem hiding this comment.
This is good work, and much of it is quite clear. But the heart of the code is complex and hard to decipher, which means maintenance in the future will be hard. Please make it clearer, so it can stay working for years to come. That might mean high-level comments explaining what it's doing, or refactoring into smaller methods with clear names and functions. The latter might be better, but either is fine.
| using System.Collections.Generic; | ||
|
|
||
| namespace Gordon360.Models.ViewModels.RecIM; | ||
| //UI SHAPE |
There was a problem hiding this comment.
This example doesn't match the definition of MatchBracketExtendedViewModel below. Why is that? It needs an explanation (unless it just needs an update to match the class).
| // "nextMatchId": null, // Id for the nextMatch in the bracket, if it's final match it must be null OR undefined | ||
| // "tournamentRoundText": "4", // Text for Round Header | ||
| // "startTime": "2021-05-30", | ||
| // "state": "DONE", // 'NO_SHOW' | 'WALK_OVER' | 'NO_PARTY' | 'DONE' | 'SCORE_DONE' Only needed to decide walkovers and if teamNames are TBD (to be decided) |
There was a problem hiding this comment.
Are these values explained somewhere?
I don't know what WALK_OVER and NO_PARTY mean, and a search of the repo doesn't show them elsewhere. And I'm wondering if DONE implies there is no score (since it's different from SCORE_DONE).
There was a problem hiding this comment.
Those are definitions that are explained in the UI package docs. I don't think it is necessary to explain in the API
Gordon360/Models/ViewModels/RecIM/TeamBracketExportViewModel.cs
Outdated
Show resolved
Hide resolved
| public string? state { get; set; } | ||
| public DateTime startTime { get; set;} | ||
| public IEnumerable<TeamBracketExportViewModel> participants { get; set; } | ||
| public int seedIndex { get; set; } |
There was a problem hiding this comment.
It might be helpful to add a comment that seedIndex is a numbering of teams from 0 to n-1, essentially a tournament seeding. NOT the seed for a randomized algorithm for assigning position in the tournament. (Assuming I've guessed correctly based on reading some of the other code.)
There was a problem hiding this comment.
not exactly, the seed index is the index of where that match exists in each round. its purely a calculation necessity
| * 2) need 'next match ID | ||
| * 3) status needs to be translated to 'state' enum | ||
| */ | ||
| var match = context.Match |
There was a problem hiding this comment.
What can we assume about context.Match?
There was a problem hiding this comment.
I don't understand what this means, context.Match is how we access our Match models in the DB. The code itself should be relatively self explanatory of why I need to contain Match.
| } | ||
| } | ||
|
|
||
| //final conversion to exact UI shape (more efficient than letting the UI handle the key/pair changes |
There was a problem hiding this comment.
This is a good comment: it explains the goal clearly enough that the code below it makes sense.
The code above could use some similar comment(s).
There was a problem hiding this comment.
There is a comment. All the code above does, is as I described:
It fills out all the invisible bye matches and injects nextMatchID into each bracket object
| public string? state { get; set; } | ||
| public DateTime startTime { get; set;} | ||
| public IEnumerable<TeamBracketExportViewModel> participants { get; set; } | ||
| public int seedIndex { get; set; } |
There was a problem hiding this comment.
not exactly, the seed index is the index of where that match exists in each round. its purely a calculation necessity
Gordon360/Models/ViewModels/RecIM/MatchBracketExportViewModel.cs
Outdated
Show resolved
Hide resolved
| // "nextMatchId": null, // Id for the nextMatch in the bracket, if it's final match it must be null OR undefined | ||
| // "tournamentRoundText": "4", // Text for Round Header | ||
| // "startTime": "2021-05-30", | ||
| // "state": "DONE", // 'NO_SHOW' | 'WALK_OVER' | 'NO_PARTY' | 'DONE' | 'SCORE_DONE' Only needed to decide walkovers and if teamNames are TBD (to be decided) |
There was a problem hiding this comment.
Those are definitions that are explained in the UI package docs. I don't think it is necessary to explain in the API
Gordon360/Models/ViewModels/RecIM/TeamBracketExportViewModel.cs
Outdated
Show resolved
Hide resolved
| * 2) need 'next match ID | ||
| * 3) status needs to be translated to 'state' enum | ||
| */ | ||
| var match = context.Match |
There was a problem hiding this comment.
I don't understand what this means, context.Match is how we access our Match models in the DB. The code itself should be relatively self explanatory of why I need to contain Match.
| } | ||
| } | ||
|
|
||
| //final conversion to exact UI shape (more efficient than letting the UI handle the key/pair changes |
There was a problem hiding this comment.
There is a comment. All the code above does, is as I described:
It fills out all the invisible bye matches and injects nextMatchID into each bracket object
Mirror UI component: gordon-cs/gordon-360-ui#2347
Rec-IM's old bracket component is no longer being updated and has quickly become an update bottleneck when we attempted to upgrade to react 18. This API PR is a has a UI mirror to handle the change to a new bracket component and its specifications.
The main key pieces required to update packages was
gettingmatch bracket data to fill out the empty spots on the bracket.