feat: add classement match system
This commit is contained in:
@@ -104,8 +104,13 @@ function scorePrint(s1) {
|
||||
return String(s1);
|
||||
}
|
||||
}
|
||||
|
||||
function scoreToString(score) {
|
||||
return score.map(o => scorePrint(o.at(0)) + "-" + scorePrint(o.at(1))).join(" | ");
|
||||
if (score.length === 0)
|
||||
return "";
|
||||
if (score.at(0) instanceof Array)
|
||||
return score.map(s => scorePrint(s.at(0)) + "-" + scorePrint(s.at(1))).join(" | ");
|
||||
return score.map(o => scorePrint(o.s1) + "-" + scorePrint(o.s2)).join(" | ");
|
||||
}
|
||||
|
||||
function dateToString(date) {
|
||||
@@ -129,7 +134,7 @@ function dateToString(date) {
|
||||
return date_.toLocaleDateString();
|
||||
}
|
||||
|
||||
function buildPouleMenu(isPoule, change_view) {
|
||||
function buildPouleMenu(isPoule, change_view, isClassement = false) {
|
||||
const menuDiv = document.createElement('div');
|
||||
menuDiv.id = 'menu';
|
||||
menuDiv.style.borderBottom = '1px solid #9EA0A1';
|
||||
@@ -188,7 +193,7 @@ function buildPouleMenu(isPoule, change_view) {
|
||||
change_view(true);
|
||||
});
|
||||
ul.appendChild(li1);
|
||||
const li2 = createTab(i18next.t('tournois'), !isPoule, function () {
|
||||
const li2 = createTab(isClassement ? i18next.t('classement') : i18next.t('tournois'), !isPoule, function () {
|
||||
change_view(false);
|
||||
});
|
||||
ul.appendChild(li2);
|
||||
@@ -262,7 +267,7 @@ function buildRankArray(rankArray) {
|
||||
}
|
||||
|
||||
function buildTree(treeData) {
|
||||
return drawGraph(initTree(treeData))
|
||||
return drawGraph(initTree(treeData.filter(d => d.data.level >= 0)))
|
||||
}
|
||||
|
||||
function poulePage(location) {
|
||||
@@ -310,7 +315,7 @@ function poulePage(location) {
|
||||
dataContainer.append(buildTree(poule['trees']));
|
||||
} else {
|
||||
const change_view = (isPoule) => {
|
||||
dataContainer.replaceChildren(buildPouleMenu(isPoule, change_view));
|
||||
dataContainer.replaceChildren(buildPouleMenu(isPoule, change_view, poule['treeIsClassement']));
|
||||
|
||||
if (isPoule) {
|
||||
for (const g in poule.matchs) {
|
||||
@@ -325,6 +330,19 @@ function poulePage(location) {
|
||||
}
|
||||
} else {
|
||||
dataContainer.append(buildTree(poule['trees']));
|
||||
if (poule['treeIsClassement'] && poule['trees'].some(d => d.data.level <= -10)) {
|
||||
dataContainer.append(buildMatchArray(
|
||||
poule['trees'].filter(d => d.data.level < 0).reverse().map(d => ({
|
||||
red: d.data.c1FullName,
|
||||
blue: d.data.c2FullName,
|
||||
score: d.data.scores,
|
||||
end: d.data.end,
|
||||
red_w: d.data.win > 0,
|
||||
blue_w: d.data.win < 0,
|
||||
eq: d.data.win === 0,
|
||||
date: d.data.date,
|
||||
}))));
|
||||
}
|
||||
}
|
||||
|
||||
location[2] = isPoule ? 1 : 2;
|
||||
@@ -392,10 +410,10 @@ function buildCombView(comb) {
|
||||
<h3>${i18next.t('statistique')} :</h3>
|
||||
<ul>
|
||||
<li>${i18next.t('tauxDeVictoire2', {
|
||||
nb: comb.matchs.length === 0 ? "---" : (comb.totalWin / comb.matchs.filter(m => m.end).length * 100).toFixed(0),
|
||||
victoires: comb.totalWin,
|
||||
matchs: comb.matchs.filter(m => m.end).length
|
||||
})}
|
||||
nb: comb.matchs.length === 0 ? "---" : (comb.totalWin / comb.matchs.filter(m => m.end).length * 100).toFixed(0),
|
||||
victoires: comb.totalWin,
|
||||
matchs: comb.matchs.filter(m => m.end).length
|
||||
})}
|
||||
</li>
|
||||
<li>${i18next.t('pointsMarqués2', {nb: comb.pointMake})}</li>
|
||||
<li>${i18next.t('pointsReçus2', {nb: comb.pointTake})}</li>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"chrono.entrezLeTempsEnS": "Enter time in seconds",
|
||||
"chrono.recapTemps": "Time: {{temps}}, pause: {{pause}}",
|
||||
"chronomètre": "Stopwatch",
|
||||
"classement": "Ranking",
|
||||
"club": "Club",
|
||||
"compétition": "Competition",
|
||||
"compétitionManager": "Competition manager",
|
||||
@@ -55,6 +56,8 @@
|
||||
"conserverUniquementLesMatchsTerminés": "Keep only finished matches",
|
||||
"contre": "vs",
|
||||
"couleur": "Color",
|
||||
"créerLesMatchesDeClassement": "Create the ranking matches",
|
||||
"créerLesMatchesDeClassement.msg": "Ranking matches have already been set up/played; recreating these matches will delete them all (you will therefore lose any results). Please note down any information you wish to keep.",
|
||||
"créerLesMatchs": "Create matches",
|
||||
"date": "Date",
|
||||
"demi-finalesEtFinales": "Semi-finals and finals",
|
||||
@@ -80,6 +83,8 @@
|
||||
"genre.na": "NA",
|
||||
"individuelle": "Individual",
|
||||
"inscrit": "Registered",
|
||||
"leTournoiServiraDePhaseFinaleAuxPoules": "The tournament will serve as the final phase for the group stage.",
|
||||
"lesCombattantsEnDehors": "Fighters not participating in the tournament will have a ranking match.",
|
||||
"listeDesCartons": "List of cards",
|
||||
"manche": "Round",
|
||||
"matchPourLesPerdantsDuTournoi": "Match for tournament losers:",
|
||||
@@ -134,6 +139,9 @@
|
||||
"toast.deleteCategory.error": "Error while deleting the category",
|
||||
"toast.deleteCategory.pending": "Deleting category...",
|
||||
"toast.deleteCategory.success": "Category deleted!",
|
||||
"toast.matchs.classement.create.error": "Error while creating ranking matches.",
|
||||
"toast.matchs.classement.create.pending": "Creating ranking matches in progress...",
|
||||
"toast.matchs.classement.create.success": "Ranking matches created successfully.",
|
||||
"toast.matchs.create.error": "Error while creating matches.",
|
||||
"toast.matchs.create.pending": "Creating matches in progress...",
|
||||
"toast.matchs.create.success": "Matches created successfully.",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"bleu": "Blue",
|
||||
"catégorie": "Category",
|
||||
"chargement": "Loading",
|
||||
"classement": "Ranking",
|
||||
"club": "Club",
|
||||
"combattant": "Fighter",
|
||||
"combattants": "Fighters",
|
||||
@@ -64,5 +65,6 @@
|
||||
"tournois": "Tournaments",
|
||||
"tousLesCombattants": "All fighters",
|
||||
"victoire": "Win",
|
||||
"victoires": "Wins"
|
||||
"victoires": "Wins",
|
||||
"classementFinal": "Final standings"
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"chrono.entrezLeTempsEnS": "Entrez le temps en s",
|
||||
"chrono.recapTemps": "Temps: {{temps}}, pause: {{pause}}",
|
||||
"chronomètre": "Chronomètre",
|
||||
"classement": "Classement",
|
||||
"club": "Club",
|
||||
"compétition": "Compétition",
|
||||
"compétitionManager": "Compétition manager",
|
||||
@@ -55,6 +56,8 @@
|
||||
"conserverUniquementLesMatchsTerminés": "Conserver uniquement les matchs terminés",
|
||||
"contre": "contre",
|
||||
"couleur": "Couleur",
|
||||
"créerLesMatchesDeClassement": "Créer les matches de classement",
|
||||
"créerLesMatchesDeClassement.msg": "Des matches de classement ont déjà été configurer/jouer, la recréation de ces matches vont tous les supprimer (vous perdre donc les résultats s'il y en a). Mercie de noter de votre côté les informations que vous voulez conserver.",
|
||||
"créerLesMatchs": "Créer les matchs",
|
||||
"date": "Date",
|
||||
"demi-finalesEtFinales": "Demi-finales et finales",
|
||||
@@ -80,6 +83,8 @@
|
||||
"genre.na": "NA",
|
||||
"individuelle": "Individuelle",
|
||||
"inscrit": "Inscrit",
|
||||
"leTournoiServiraDePhaseFinaleAuxPoules": "Le tournoi servira de phase finale aux poules",
|
||||
"lesCombattantsEnDehors": "Les combattants en dehors du tournoi auront un match de classement",
|
||||
"listeDesCartons": "Liste des cartons",
|
||||
"manche": "Manche",
|
||||
"matchPourLesPerdantsDuTournoi": "Match pour les perdants du tournoi:",
|
||||
@@ -134,6 +139,9 @@
|
||||
"toast.deleteCategory.error": "Erreur lors de la suppression de la catégorie",
|
||||
"toast.deleteCategory.pending": "Suppression de la catégorie...",
|
||||
"toast.deleteCategory.success": "Catégorie supprimée !",
|
||||
"toast.matchs.classement.create.error": "Erreur lors de la création des matchs de classement.",
|
||||
"toast.matchs.classement.create.pending": "Création des matchs de classement en cours...",
|
||||
"toast.matchs.classement.create.success": "Matchs de classement créés avec succès.",
|
||||
"toast.matchs.create.error": "Erreur lors de la création des matchs.",
|
||||
"toast.matchs.create.pending": "Création des matchs en cours...",
|
||||
"toast.matchs.create.success": "Matchs créés avec succès.",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"bleu": "Bleu",
|
||||
"catégorie": "Catégorie",
|
||||
"chargement": "Chargement",
|
||||
"classement": "Classement",
|
||||
"club": "Club",
|
||||
"combattant": "Combattant",
|
||||
"combattants": "Combattants",
|
||||
@@ -64,5 +65,6 @@
|
||||
"tournois": "Tournois",
|
||||
"tousLesCombattants": "Tous les combattants",
|
||||
"victoire": "Victoire",
|
||||
"victoires": "Victoires"
|
||||
"victoires": "Victoires",
|
||||
"classementFinal": "Classement final"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user