Feat: Calcul de temps de jeu total pour les lignes
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { useState } from "react";
|
||||
import { useLocalData } from "../context/useLocalData";
|
||||
import { AthleteList, ActiviteList, CoachList, SessionList, LigneList} from "./ressourceList";
|
||||
import { Activite, Athlete, Coach , Session, Ligne } from "../classes";
|
||||
import { useState } from "react";
|
||||
import { useLocalData } from "../context/useLocalData";
|
||||
import { AthleteList, ActiviteList, CoachList, SessionList, LigneList} from "./ressourceList";
|
||||
import { Activite, Athlete, Coach , Session, Ligne } from "../classes";
|
||||
import {calculTempsDeJeuParLigne} from "../utils/ligneUtils";
|
||||
import { keyboard } from "@testing-library/user-event/dist/keyboard";
|
||||
import { unescapeLeadingUnderscores } from "typescript";
|
||||
|
||||
|
||||
export type keyWord = "athletes" | "activites" | "coachs" | "sessions"| "lignes";
|
||||
@@ -11,6 +13,7 @@ import { keyboard } from "@testing-library/user-event/dist/keyboard";
|
||||
const { user } = useLocalData();
|
||||
const [value,setValue] = useState<keyWord>("athletes");
|
||||
console.log("Rôle utilisateur:", user.role);
|
||||
console.log("name", user.nom);
|
||||
if (user.role === "Athlete") return null;
|
||||
|
||||
|
||||
@@ -52,7 +55,16 @@ import { keyboard } from "@testing-library/user-event/dist/keyboard";
|
||||
}
|
||||
});
|
||||
|
||||
const allLignes: Ligne[] = Array.from(ligneMap.values());
|
||||
|
||||
const allLignes: Ligne[] = Array.from(ligneMap.values());
|
||||
|
||||
// Calculer le temps de jeu pour chaque ligne
|
||||
const tempsDeJeuParLigne: Map<number, number> = new Map();
|
||||
allLignes.forEach(ligne => {
|
||||
const tempsTotal = calculTempsDeJeuParLigne(allSessions, ligne);
|
||||
tempsDeJeuParLigne.set(ligne.id, tempsTotal);
|
||||
ligne.tempsDeJeu = tempsTotal;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +117,7 @@ import { keyboard } from "@testing-library/user-event/dist/keyboard";
|
||||
{value==="lignes" && (
|
||||
<div className="edt_lignes_panel">
|
||||
<h3>Liste des lignes</h3>
|
||||
<LigneList lignes={allLignes} />
|
||||
<LigneList lignes={allLignes} tempsDeJeuParLigne={tempsDeJeuParLigne}/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user