-
Notifications
You must be signed in to change notification settings - Fork 2
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
Format players' names (URL : 'xml_liste_joueur_o'), trim sets details, and add two Joueur() properties #17
base: main
Are you sure you want to change the base?
Format players' names (URL : 'xml_liste_joueur_o'), trim sets details, and add two Joueur() properties #17
Conversation
…RencontreDetailsFactory's code, add /Model/Joueur properties "echelon" and "place"
…eDetails, trim() sets details, add unit tests
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.
Some suggestions.
Can you alse rebase/merge main ?
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) : []; |
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.
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']) { |
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.
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
$setsDetails = array_map(function ($setDetail) { | ||
return intval($setDetail); | ||
}, explode(' ', trim($partieData['detail']))); |
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.
Something like that ?
$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 PR has several goals: