Format players' names (URL : 'xml_liste_joueur_o'), trim sets details, and add two Joueur() properties#17
Open
StephSako wants to merge 14 commits intoalamirault:mainfrom
Open
Conversation
…RencontreDetailsFactory's code, add /Model/Joueur properties "echelon" and "place"
…eDetails, trim() sets details, add unit tests
alamirault
requested changes
Mar 30, 2023
Owner
alamirault
left a comment
There was a problem hiding this comment.
Some suggestions.
Can you alse rebase/merge main ?
Comment on lines
30
to
+38
| foreach ($array['joueur'] as $joueur) { | ||
| $joueursA[] = [$joueur['xja'] ?: '', $joueur['xca'] ?: '']; | ||
| $joueursB[] = [$joueur['xjb'] ?: '', $joueur['xcb'] ?: '']; | ||
| $joueursA[] = ['nom' => $joueur['xja'] ?: '', 'points' => $joueur['xca'] ?: '']; | ||
| $joueursB[] = ['nom' => $joueur['xjb'] ?: '', 'points' => $joueur['xcb'] ?: '']; | ||
| } | ||
| $joueursAFormatted = $this->formatJoueurs($joueursA, $clubEquipeA); | ||
| $joueursBFormatted = $this->formatJoueurs($joueursB, $clubEquipeB); | ||
|
|
||
| $wholeTeamAForfeit = 0 === count(array_filter($joueursA, function ($joueurA) { return $joueurA['nom'] && $joueurA['points']; })); | ||
| $wholeTeamBForfeit = 0 === count(array_filter($joueursB, function ($joueurB) { return $joueurB['nom'] && $joueurB['points']; })); | ||
| $joueursAFormatted = !$wholeTeamAForfeit ? $this->formatJoueurs($joueursA, $clubEquipeA) : []; | ||
| $joueursBFormatted = !$wholeTeamBForfeit ? $this->formatJoueurs($joueursB, $clubEquipeB) : []; |
Owner
There was a problem hiding this comment.
WDYT of this instead ?
$wholeTeamAForfeit = true;
$wholeTeamBForfeit = true;
foreach ($array['joueur'] as $joueur) {
$nomJoueurA = $joueur['xja'];
$pointsJoueurA = $joueur['xca'];
if($nomJoueurA && $pointsJoueurA){
$wholeTeamAForfeit = false;
}
$nomJoueurB = $joueur['xjb'];
$pointsJoueurB = $joueur['xcb'];
if($nomJoueurB && $pointsJoueurB){
$wholeTeamBForfeit = false;
}
$joueursA[] = ['nom' => $nomJoueurA, 'points' => $pointsJoueurA];
$joueursB[] = ['nom' => $nomJoueurB, 'points' => $pointsJoueurB];
}| $nomPrenom = $joueurData[0]; | ||
| [$nom, $prenom] = $this->nomPrenomExtractor->extractNomPrenom($nomPrenom); | ||
| $joueurs[$this->nomPrenomExtractor->removeSeparatorsDuplication($nomPrenom)] = $this->formatJoueur($prenom, $nom, $joueurData[1], $joueursClub); | ||
| if ($joueurData['nom'] && $joueurData['points']) { |
Owner
There was a problem hiding this comment.
So in this way, we can have 4 players in left, and 3 players in right, is not a problem ?
Historically I wanted always same number of players on left and right
Comment on lines
+195
to
+197
| $setsDetails = array_map(function ($setDetail) { | ||
| return intval($setDetail); | ||
| }, explode(' ', trim($partieData['detail']))); |
Owner
There was a problem hiding this comment.
Something like that ?
Suggested change
| $setsDetails = array_map(function ($setDetail) { | |
| return intval($setDetail); | |
| }, explode(' ', trim($partieData['detail']))); | |
| $setsDetails = array_map(fn (string $setDetail): int => (int) $setDetail, explode(' ', trim($partieData['detail']))); |
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.
This PR has several goals: