diff --git a/Sources/src/app/controller/AthleteController.php b/Sources/src/app/controller/AthleteController.php
index 1f8b0bf6..0a61b7a6 100644
--- a/Sources/src/app/controller/AthleteController.php
+++ b/Sources/src/app/controller/AthleteController.php
@@ -4,6 +4,7 @@ namespace App\Controller;
use Database\ActivityGateway;
use Database\ActivityMapper;
+use Database\AnalyzeGateway;
use Database\AthleteEntity;
use Database\AthleteMapper;
use Database\EntrainementGateway;
@@ -90,10 +91,13 @@ class AthleteController extends BaseController
} else {
try {
$athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
- $listSearch = $athleteGateway->getAthlete($username);
+ if($username==null){
+ $listSearch=$athleteGateway->getAthlete();
+ } else {
+ $listSearch = $athleteGateway->getAthleteByName($username);
+ }
$map = new AthleteMapper();
$athleteEntity = $map->athleteSqlToEntity($listSearch);
-
$listUsers = [];
foreach ($athleteEntity as $entity) {
$user = $map->athleteEntityToModel($entity);
@@ -120,36 +124,25 @@ class AthleteController extends BaseController
return $response;
}
- #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
- public function analyses(): Response
+ #[Route(path: '/analyze', name: 'analyze_details', methods: ['GET'])]
+ public function activityDetails(int $id): Response
{
try {
- $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
- $listSearch = $activityGateway->getActivity();
- $map = new ActivityMapper();
- $activityGateway = $map->activitySqlToEntity($listSearch);
- $listActivity = [];
- foreach ($activityGateway as $entity) {
- $activity = $map->activityEntityToModel($entity);
- $listActivity[] = ['idactivity' => number_format($activity->getIdActivity(), 1), 'type' => $activity->getType(),
- 'date' => $activity->getDate()->format("D j F Y"), 'heureDebut' => $activity->getHeureDebut()->format("H\h i"), 'heureFin' => $activity->getHeureFin()->format("H\h i"),
- 'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
- 'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
- 'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' =>$activity->getAvrTemperature()];
- }
+ // Utilisez $id pour récupérer les détails de l'activité depuis la base de données
+// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
+// $activityEntity = $activityGateway->getActivityById($id); // Assurez-vous d'avoir une méthode similaire dans votre gateway
+
+ $analyzeGateway = new AnalyzeGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
+ $analyzeEntity = $analyzeGateway->getFrequenceCardiaqueByIdActivity($id);
- $response = $this->render('./page/analyze.html.twig',[
+ $response = $this->render('./page/analyze.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [],
- 'analyzes' => $listActivity,
- 'mails' => [],
- 'users' => [],
- 'infoUser' => [],
- 'exos' => [],
- 'member' => []
+ 'activity' => [],
+ 'analyzes' => $analyzeEntity,
]);
} catch (\Throwable $th) {
throw $th;
@@ -158,6 +151,45 @@ class AthleteController extends BaseController
return $response;
}
+//
+// #[Route(path: '/analyses/{id}', name: 'analyses', methods: ['GET'])]
+// public function analyses(): Response
+// {
+// try {
+// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
+// $listSearch = $activityGateway->getActivity();
+// $map = new ActivityMapper();
+// $activityGateway = $map->activitySqlToEntity($listSearch);
+// $listActivity = [];
+// foreach ($activityGateway as $entity) {
+// $activity = $map->activityEntityToModel($entity);
+// $listActivity[] = ['idactivity' => number_format($activity->getIdActivity(), 1), 'type' => $activity->getType(),
+// 'date' => $activity->getDate()->format("D j F Y"), 'heureDebut' => $activity->getHeureDebut()->format("H\h i"), 'heureFin' => $activity->getHeureFin()->format("H\h i"),
+// 'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
+// 'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
+// 'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' =>$activity->getAvrTemperature()];
+// }
+//
+// $response = $this->render('./page/analyze.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => 'johndoe',//$currentUser->getUsername(),
+// 'role' => 'Athlete',//$currentUser->getRole(),
+// 'friendship' => [],
+// 'analyzes' => $listActivity,
+// 'mails' => [],
+// 'users' => [],
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => []
+// ]);
+// } catch (\Throwable $th) {
+// throw $th;
+// return $this->render("./page/analyze.html.twig", ['tabError' => $taberror]);
+// }
+// return $response;
+// }
+
#[Route(path: '/activity', name: 'activity', methods: ['GET'])]
public function activity(): Response
{
@@ -169,7 +201,7 @@ class AthleteController extends BaseController
$listActivity = [];
foreach ($activityGateway as $entity) {
$activity = $map->activityEntityToModel($entity);
- $listActivity[] = ['idactivity' => number_format($activity->getIdActivity(), 1), 'type' => $activity->getType(),
+ $listActivity[] = ['idactivity' => number_format($activity->getIdActivity()), 'type' => $activity->getType(),
'date' => $activity->getDate()->format("D j F Y"), 'heureDebut' => $activity->getHeureDebut()->format("H\h i"), 'heureFin' => $activity->getHeureFin()->format("H\h i"),
'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
diff --git a/Sources/src/app/controller/CoachController.php b/Sources/src/app/controller/CoachController.php
index 9deb8b3d..bf409633 100644
--- a/Sources/src/app/controller/CoachController.php
+++ b/Sources/src/app/controller/CoachController.php
@@ -7,6 +7,7 @@ use App\Router\Request\IRequest;
use App\Router\Response\Response;
use App\Router\Response\IResponse;
+use Manager\DataManager;
use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
@@ -16,16 +17,16 @@ use Shared\Log;
class CoachController extends BaseController
{
- private ICoachManager $coachManager;
- private $security;
- private Environment $twig;
+// private ICoachManager $coachManager;
+// private $security;
+// private Environment $twig;
protected Preferences $preference;
- public function __construct(DataManager $dataManager, Security $security)
+ public function __construct()
{
- session_start();
- $this->coachManager = $dataManager->coachMgr;
- $this->security = $security;
+// session_start();
+// $this->coachManager = $dataManager->coachMgr;
+// $this->security = $security;
$this->preference = new Preferences();
}
diff --git a/Sources/src/app/controller/HeartRateController.php b/Sources/src/app/controller/HeartRateController.php
index 9e7090e9..e250f829 100644
--- a/Sources/src/app/controller/HeartRateController.php
+++ b/Sources/src/app/controller/HeartRateController.php
@@ -18,7 +18,6 @@ class HeartRateController extends BaseController
public function __construct()
{
- session_start();
$this->preference = new Preferences();
}
diff --git a/Sources/src/app/controller/UserController.php b/Sources/src/app/controller/UserController.php
index 6b3091af..ca403f69 100644
--- a/Sources/src/app/controller/UserController.php
+++ b/Sources/src/app/controller/UserController.php
@@ -9,6 +9,8 @@ use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
+use Database\Athletegateway;
+use Database\Connexion;
class UserController extends BaseController
{
@@ -43,6 +45,28 @@ class UserController extends BaseController
#[Route(path: '/home', name: 'home', methods: ['GET'])]
public function home(): Response
{
+ $athleteGateway = new AthleteGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
+ $activity = $athleteGateway->getListActivity('1');//$currentUser->getId()
+// Log::dd($activity);
+ $chart = [];
+ foreach($activity as $act){
+ $chart[] = ['act' => $act['nbactivite'], 'mois' => date('m', $act['mois'])];
+ }
+
+// $activityGateway = new ActivityGateway(new Connexion(DSN, DB_USER, DB_PASSWORD));
+// $listSearch = $activityGateway->getActivity();
+// $map = new ActivityMapper();
+// $activityGateway = $map->activitySqlToEntity($listSearch);
+// $listActivity = [];
+// foreach ($activityGateway as $entity) {
+// $activity = $map->activityEntityToModel($entity);
+// $listActivity[] = ['idactivity' => number_format($activity->getIdActivity()), 'type' => $activity->getType(),
+// 'date' => $activity->getDate()->format("D j F Y"), 'heureDebut' => $activity->getHeureDebut()->format("H\h i"), 'heureFin' => $activity->getHeureFin()->format("H\h i"),
+// 'effortRessenti' => $activity->getEffortRessenti(), 'variabilite' => $activity->getVariability(), 'variance' => $activity->getVariance(),
+// 'ecartType' => $activity->getStandardDeviation(), 'moyenne' => $activity->getAverage(),
+// 'max' => $activity->getMaximum(), 'min' => $activity->getMinimum(), 'temperature' => $activity->getAvrTemperature()];
+// }
+// Log::dd($chart);
return $this->render('./page/home.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
@@ -50,6 +74,7 @@ class UserController extends BaseController
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
+ 'chart' => $chart,
'mails' => [],
'users' => [],
'infoUser' => [],
diff --git a/Sources/src/app/views/Templates/page/activity.html.twig b/Sources/src/app/views/Templates/page/activity.html.twig
index be5fb8bd..e14809bc 100644
--- a/Sources/src/app/views/Templates/page/activity.html.twig
+++ b/Sources/src/app/views/Templates/page/activity.html.twig
@@ -67,8 +67,8 @@
{{analyze.max}} Bpm |
{{analyze.min}} Bpm |
{{analyze.temperature}} °C |
-{# En savoir plus | #}
- En savoir plus |
+ {{analyze.idactivity}} °C |
+ En savoir plus |
{% endfor %}
diff --git a/Sources/src/app/views/Templates/page/analyze.html.twig b/Sources/src/app/views/Templates/page/analyze.html.twig
index f22c8801..712b9708 100755
--- a/Sources/src/app/views/Templates/page/analyze.html.twig
+++ b/Sources/src/app/views/Templates/page/analyze.html.twig
@@ -14,34 +14,135 @@
- Accueil
- Exercices
+
-
-
-
-
- {% for analyze in analyzes %}
+
+
- {{analyze.date}} |
- {{analyze.heureDebut}} |
- {{analyze.heureFin}} |
- {{analyze.type}} |
- {{analyze.effortRessenti}} |
- {{analyze.variabilite}} |
- {{analyze.variance}} |
- {{analyze.ecartType}} |
- {{analyze.moyenne}} Bpm |
- {{analyze.max}} Bpm |
- {{analyze.min}} Bpm |
- {{analyze.temperature}} °C |
- En savoir plus |
+ id FC |
+ altitude |
+ temps |
+ Temperature |
+ bpm |
+ longitude |
+ latitude |
+ activiteid |
+ |
- {% endfor %}
+
+ {% for analyze in analyzes %}
+
+
+ {{analyze.idfc}} |
+ {{analyze.altitude}} |
+ {{analyze.temps}} |
+ {{analyze.temperature}} |
+ {{analyze.bpm}} |
+ {{analyze.longitude}} |
+ {{analyze.latitude}} |
+ {{analyze.activiteid}} |
+ Home |
+
+
+ {% endfor %}
+
+{#
#}
+{#
#}
+{#
#}
+{# #}
+{# #}
+
+
+
+
+
+
diff --git a/Sources/src/app/views/Templates/page/exercice.html.twig b/Sources/src/app/views/Templates/page/exercice.html.twig
index 371a3317..07b08632 100755
--- a/Sources/src/app/views/Templates/page/exercice.html.twig
+++ b/Sources/src/app/views/Templates/page/exercice.html.twig
@@ -21,7 +21,7 @@
-
+
diff --git a/Sources/src/app/views/Templates/page/home.html.twig b/Sources/src/app/views/Templates/page/home.html.twig
index 6ade985b..d626f45f 100755
--- a/Sources/src/app/views/Templates/page/home.html.twig
+++ b/Sources/src/app/views/Templates/page/home.html.twig
@@ -21,8 +21,55 @@
Stastiques globales
+
- {# #}
+
+
+
+{# #}
diff --git a/Sources/src/data/core/database/ActivityGateway.php b/Sources/src/data/core/database/ActivityGateway.php
index ed6db38c..3d9e9564 100644
--- a/Sources/src/data/core/database/ActivityGateway.php
+++ b/Sources/src/data/core/database/ActivityGateway.php
@@ -17,7 +17,7 @@ class ActivityGateway {
public function getActivityById(int $activityId) {
$query = "SELECT * FROM Activite WHERE idActivite = :id";
- $params = [':id' => [$activityId, PDO::PARAM_INT]];
+ $params = [':id' => $activityId];
return $this->connection->executeWithErrorHandling($query, $params);
}
diff --git a/Sources/src/data/core/database/AnalyzeEntity.php b/Sources/src/data/core/database/AnalyzeEntity.php
new file mode 100644
index 00000000..4560f7b7
--- /dev/null
+++ b/Sources/src/data/core/database/AnalyzeEntity.php
@@ -0,0 +1,79 @@
+idFc;
+ }
+ public function getAltitude()
+ {
+ return $this->altitude;
+ }
+ public function getTime()
+ {
+ return $this->temps;
+ }
+ public function getTemperature()
+ {
+ return $this->temperature;
+ }
+ public function getBpm()
+ {
+ return $this->bpm;
+ }
+ public function getLongitude()
+ {
+ return $this->longitude;
+ }
+ public function getLatitude()
+ {
+ return $this->latitude;
+ }
+ public function getIdActivity()
+ {
+ return $this->idactivity;
+ }
+ public function setIdFC($idFc)
+ {
+ $this->idFc = $idFc;
+ }
+ public function setAltitude($altitude)
+ {
+ $this->altitude = $altitude;
+ }
+ public function setTime($time)
+ {
+ $this->time = $time;
+ }
+ public function setTemperature($temperature)
+ {
+ $this->temperature = $temperature;
+ }
+ public function setBpm($bpm)
+ {
+ $this->bpm = $bpm;
+ }
+ public function setLongitude($longitude)
+ {
+ $this->longitude = $longitude;
+ }
+ public function setLatitude($latitude)
+ {
+ $this->latitude = $latitude;
+ }
+ public function setIdActivity($idactivity)
+ {
+ $this->idactivity = $idactivity;
+ }
+}
\ No newline at end of file
diff --git a/Sources/src/data/core/database/AnalyzeGateway.php b/Sources/src/data/core/database/AnalyzeGateway.php
new file mode 100644
index 00000000..7dd7666a
--- /dev/null
+++ b/Sources/src/data/core/database/AnalyzeGateway.php
@@ -0,0 +1,24 @@
+connection = $connection;
+ }
+
+ public function getFrequenceCardiaque() {
+ $query = "SELECT * FROM FrequenceCardiaque";
+ return $this->connection->executeWithErrorHandling($query);
+ }
+ public function getFrequenceCardiaqueByIdActivity(int $activityId)
+ {
+ $query = "SELECT * FROM FrequenceCardiaque WHERE activiteid = :id";
+ $params = [':id' => $activityId];
+ return $this->connection->executeWithErrorHandling($query, $params);
+ }
+
+}
\ No newline at end of file
diff --git a/Sources/src/data/core/database/AnalyzeMapper.php b/Sources/src/data/core/database/AnalyzeMapper.php
new file mode 100644
index 00000000..33077162
--- /dev/null
+++ b/Sources/src/data/core/database/AnalyzeMapper.php
@@ -0,0 +1,125 @@
+setIdActivity($analyzeData['idactivite']);
+ }
+
+ if (isset($analyzeData['type'])) {
+ $analyze->setType($analyzeData['type']);
+ }
+
+ if (isset($analyzeData['date'])) {
+ $analyze->setDate($analyzeData['date']);
+ }
+
+ if (isset($analyzeData['heurededebut'])) {
+ $analyze->setHeureDebut($analyzeData['heurededebut']);
+ }
+
+ if (isset($analyzeData['heuredefin'])) {
+ $analyze->setHeureFin($analyzeData['heuredefin']);
+ }
+
+ if (isset($analyzeData['effortressent'])) {
+ $analyze->setEffortRessenti($analyzeData['effortressent']);
+ }
+
+ if (isset($analyzeData['variabilite'])) {
+ $analyze->setVariabilite($analyzeData['variabilite']);
+ }
+
+ if (isset($analyzeData['variance'])) {
+ $analyze->setVariance($analyzeData['variance']);
+ }
+
+ if (isset($analyzeData['ecarttype'])) {
+ $analyze->setEcartType($analyzeData['ecarttype']);
+ }
+
+ if (isset($analyzeData['moyenne'])) {
+ $analyze->setMoyenne($analyzeData['moyenne']);
+ }
+
+ if (isset($analyzeData['maximum'])) {
+ $analyze->setMaximum($analyzeData['maximum']);
+ }
+
+ if (isset($analyzeData['minimum'])) {
+ $analyze->setMinimum($analyzeData['minimum']);
+ }
+
+ if (isset($analyzeData['temperaturemoyenne'])) {
+ $analyze->setTemperatureMoyenne($analyzeData['temperaturemoyenne']);
+ }
+
+ $analyzeEntities[] = $analyze;
+ }
+ return $analyzeEntities;
+ }
+
+ /**
+ * @throws \Exception
+ */
+// public function ActivityEntityToModel(ActivityEntity $activiteEntity):Activity {
+// $date = new DateTime($activiteEntity->getDate());
+// $heureDebut = new \DateTime($activiteEntity->getHeureDebut());
+// $heureFin = new \DateTime($activiteEntity->getHeureFin());
+// $effortRessenti = intval($activiteEntity->getEffortRessenti());
+// $variability = floatval($activiteEntity->getVariability());
+// $variance = floatval($activiteEntity->getVariance());
+// $ecartType = floatval($activiteEntity->getEcartType());
+//
+// $act = new Activity(
+// $activiteEntity->getIdActivity(),
+// $activiteEntity->getType(),
+// $date,
+// $heureDebut,
+// $heureFin,
+// $effortRessenti,
+// $variability,
+// $variance,
+// $ecartType,
+// $activiteEntity->getMoyenne(),
+// $activiteEntity->getMaximum(),
+// $activiteEntity->getMinimum(),
+// $activiteEntity->getTemperatureMoyenne(),
+// 'false'
+// );
+//
+// return $act;
+// }
+ //public function ActivityToEntity(Activity model): ActivityEntity;
+
+// public function activityToEntity( $act):ActivityEntity{
+//
+// $act = new ActivityEntity();
+// $act->setIdActivity($act->getIdActivity()());
+// $act->setType($act->getType());
+// $act->setDate($act->getDate());
+// $act->setHeureDebut($act->getHeureDebut());
+// $act->setHeureFin($act->getHeureFin());
+// $act->setEffortRessenti($act->getEffortRessenti());
+// $act->setVariabilite($act->getVariability());
+// $act->setVariance($act->getVariance());
+// $act->setEcartType($act->getEcartType());
+// $act->setMoyenne($act->getMoyenne());
+// $act->setMaximum($act->getMaximum());
+// $act->setMinimum($act->getMinimum());
+// $act->setTemperatureMoyenne($act->getTemperatureMoyenne());
+//
+// return $act;
+// }
+}
\ No newline at end of file
diff --git a/Sources/src/data/core/database/AthleteGateway.php b/Sources/src/data/core/database/AthleteGateway.php
index 22a78fbd..a6677c89 100644
--- a/Sources/src/data/core/database/AthleteGateway.php
+++ b/Sources/src/data/core/database/AthleteGateway.php
@@ -30,7 +30,7 @@ class AthleteGateway {
public function getAthleteByName(string $name): array
{
$query = "SELECT * FROM Athlete WHERE nom = :name AND isCoach=FALSE";
- $params = [':name' => [$name, PDO::PARAM_STR]];
+ $params = [':name' => $name];
return $this->connection->executeWithErrorHandling($query, $params);
}
@@ -87,6 +87,23 @@ class AthleteGateway {
return $this->connection->executeWithErrorHandling($query, $params);
}
+ public function getListActivity(int $idAthlete): array
+ {
+ $query = "SELECT count(ac.idActivite) AS nbActivite, EXTRACT(MONTH FROM ac.date) AS mois
+ FROM Athlete at, Activite ac
+ WHERE at.idAthlete = :idAthlete
+ AND ac.date > CURRENT_DATE - INTERVAL '1 YEAR'
+ AND ac.athleteId = at.idAthlete
+ GROUP BY mois";
+
+ $params = [
+ ':idAthlete' => $idAthlete,
+ ];
+
+ return $this->connection->executeWithErrorHandling($query, $params);
+ }
+
+
public function addAthlete(AthleteEntity $athlete): array
{
$query = "INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach)
diff --git a/Sources/src/data/core/database/AthleteMapper.php b/Sources/src/data/core/database/AthleteMapper.php
index 08b39822..e9572ca4 100644
--- a/Sources/src/data/core/database/AthleteMapper.php
+++ b/Sources/src/data/core/database/AthleteMapper.php
@@ -14,8 +14,8 @@ class AthleteMapper {
foreach ($data as $athleteData) {
$athlete = new AthleteEntity();
- if (isset($athleteData['idathlete'])) {
- $athlete->setIdAthlete($athleteData['idathlete']);
+ if (isset($athleteData['idAthlete'])) {
+ $athlete->setIdAthlete($athleteData['idAthlete']);
}
if (isset($athleteData['nom'])) {
@@ -46,16 +46,16 @@ class AthleteMapper {
$athlete->setPoids($athleteData['poids']);
}
- if (isset($athleteData['motdepasse'])) {
- $athlete->setMotDePasse($athleteData['motdepasse']);
+ if (isset($athleteData['motDePasse'])) {
+ $athlete->setMotDePasse($athleteData['motDePasse']);
}
- if (isset($athleteData['datenaissance'])) {
- $athlete->setDateNaissance($athleteData['datenaissance']);
+ if (isset($athleteData['dateNaissance'])) {
+ $athlete->setDateNaissance($athleteData['dateNaissance']);
}
- if (isset($athleteData['iscoach'])) {
- $athlete->setIsCoach($athleteData['iscoach']);
+ if (isset($athleteData['isCoach'])) {
+ $athlete->setIsCoach($athleteData['isCoach']);
}
$athleteEntities[] = $athlete;
diff --git a/Sources/src/data/core/database/NotificationGateway.php b/Sources/src/data/core/database/NotificationGateway.php
index 8ee36c5b..c1050ab9 100644
--- a/Sources/src/data/core/database/NotificationGateway.php
+++ b/Sources/src/data/core/database/NotificationGateway.php
@@ -20,8 +20,8 @@ class NotificationGateway
}
public function addNotification(NotificationEntity $notif){
- $query = "INSERT INTO Notification (idnotif, message, date, statut, urgence, athleteid) VALUES (:idNotif, :message, :date, :statut, :urgence, :idAthlete)";
- $params = [':idNotif'=>$notif->getIdNotif(), ':message'=>$notif->getMessage(), ':date'=>$notif->getDate(), ':statut'=>$notif->getStatut(), ':urgence'=>$notif->getUrgence(), ':idAthlete'=>$notif->getIdAthlete()];
+ $query = "INSERT INTO Notification (message, date, statut, urgence, athleteid) VALUES (:message, :date, :statut, :urgence, :idAthlete)";
+ $params = [':message'=>$notif->getMessage(), ':date'=>$notif->getDate(), ':statut'=>$notif->getStatut(), ':urgence'=>$notif->getUrgence(), ':idAthlete'=>$notif->getIdAthlete()];
return $this->connection->executeWithErrorHandling($query, $params);
}
}
\ No newline at end of file
diff --git a/Sources/src/data/core/database/data/athlete.sql b/Sources/src/data/core/database/data/athlete.sql
new file mode 100644
index 00000000..51c2b19a
--- /dev/null
+++ b/Sources/src/data/core/database/data/athlete.sql
@@ -0,0 +1,6 @@
+INSERT INTO Athlete (idAthlete, username, nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach) VALUES
+ (1, 'johnD63', 'Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01', FALSE),
+ (2, 'janeS03', 'Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02', TRUE),
+ (3, 'bryanO', 'OConner', 'Bryan', 'bryan.oconner@example.com', 'M', 1.88, 86, 'password789', '1973-09-12', FALSE),
+ (4, 'dominicT', 'Toretto', 'Dominic', 'dominic.toretto@example.com', 'M', 1.83, 94, 'password987', '1967-07-18', TRUE),
+ (5, 'miaT', 'Toretto', 'Mia', 'mia.toretto@example.com', 'F', 1.70, 56, 'password654', '1980-04-26', FALSE);
\ No newline at end of file
diff --git a/Sources/src/data/core/database/data/frequenceCardiaque.sql b/Sources/src/data/core/database/data/frequenceCardiaque.sql
new file mode 100644
index 00000000..a602a401
--- /dev/null
+++ b/Sources/src/data/core/database/data/frequenceCardiaque.sql
@@ -0,0 +1,21 @@
+INSERT INTO FrequenceCardiaque VALUES(1, 100, '08:15:00', 15, 130, 45.75771709151474, 3.113484980409329, 1);
+INSERT INTO FrequenceCardiaque VALUES
+ (2, ROUND(RANDOM() * 10 + 90), '08:16:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75772709151474, 3.113494980409329, 1),
+ (3, ROUND(RANDOM() * 10 + 90), '08:17:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75773709151474, 3.113504980409329, 1),
+ (4, ROUND(RANDOM() * 10 + 90), '08:18:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75774709151474, 3.113514980409329, 1),
+ (5, ROUND(RANDOM() * 10 + 90), '08:19:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75775709151474, 3.113524980409329, 1),
+ (6, ROUND(RANDOM() * 10 + 90), '08:20:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75776709151474, 3.113534980409329, 1),
+ (7, ROUND(RANDOM() * 10 + 90), '08:21:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75777709151474, 3.113544980409329, 1),
+ (8, ROUND(RANDOM() * 10 + 90), '08:22:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75778709151474, 3.113554980409329, 1),
+ (9, ROUND(RANDOM() * 10 + 90), '08:23:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75779709151474, 3.113564980409329, 1),
+ (10, ROUND(RANDOM() * 10 + 90), '08:24:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75780709151474, 3.113574980409329, 1),
+ (11, ROUND(RANDOM() * 10 + 90), '08:25:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75781709151474, 3.113584980409329, 1),
+ (12, ROUND(RANDOM() * 10 + 90), '08:26:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75782709151474, 3.113594980409329, 1),
+ (13, ROUND(RANDOM() * 10 + 90), '08:27:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75783709151474, 3.113604980409329, 1),
+ (14, ROUND(RANDOM() * 10 + 90), '08:28:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75784709151474, 3.113614980409329, 1),
+ (15, ROUND(RANDOM() * 10 + 90), '08:29:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75785709151474, 3.113624980409329, 1),
+ (16, ROUND(RANDOM() * 10 + 90), '08:30:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75786709151474, 3.113634980409329, 1),
+ (17, ROUND(RANDOM() * 10 + 90), '08:31:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75787709151474, 3.113644980409329, 1),
+ (18, ROUND(RANDOM() * 10 + 90), '08:32:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75788709151474, 3.113654980409329, 1),
+ (19, ROUND(RANDOM() * 10 + 90), '08:33:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75789709151474, 3.113664980409329, 1),
+ (20, ROUND(RANDOM() * 10 + 90), '08:34:00', ROUND(RANDOM() * 5 + 10), ROUND(RANDOM() * 20 + 110), 45.75790709151474, 3.113674980409329, 1);
\ No newline at end of file
diff --git a/Sources/src/data/core/database/data/friendship.sql b/Sources/src/data/core/database/data/friendship.sql
new file mode 100644
index 00000000..da8b2a52
--- /dev/null
+++ b/Sources/src/data/core/database/data/friendship.sql
@@ -0,0 +1,29 @@
+INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES
+ (3, 4, '2023-01-01'),
+ (3, 5, '2023-01-12');
+
+INSERT INTO Notification (idNotif, message, date, statut, urgence, athleteId) VALUES
+ (1, 'Training session at 10 AM', '2023-03-10', TRUE, 1, 1),
+ (2, 'Training session at 3 PM', '2023-05-10', TRUE, 1, 2);
+
+INSERT INTO Statistique (idStatistique, poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES
+ (1, 70, 80, 150, 500, '2023-03-10', 1),
+ (2, 86, 95, 170, 896, '2023-04-13', 3);
+
+INSERT INTO Entrainement (idEntrainement, date, description, latitude, longitude, feedback, athleteId) VALUES
+ (1, '2023-03-10', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1),
+ (2, '2023-04-13', 'Long run in the forest', 44.7128, -70.0060, 'Pretty good effort', 3);
+
+INSERT INTO Participe (athleteId, entrainementId) VALUES
+ (1, 1),
+ (3, 2);
+
+INSERT INTO SourceDonnee (idSource, type, modele, precision2, athleteId) VALUES
+ (1, 'Heart Rate Monitor', 'HRM-Pro', 98.5, 1);
+
+INSERT INTO Activite (idActivite, type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES
+ (1, 'Running', '2023-03-10', '08:00:00', '09:00:00', 3, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1),
+ (2, 'Running Forest', '2023-04-13', '10:00:00', '12:00:00', 5, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1);
+
+INSERT INTO FrequenceCardiaque (idFc, altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES
+ (1, 100, '08:15:00', 15, 130, -74.0060, 40.7128, 1);
\ No newline at end of file
diff --git a/Sources/src/data/core/database/db.sql b/Sources/src/data/core/database/data/tables.sql
similarity index 71%
rename from Sources/src/data/core/database/db.sql
rename to Sources/src/data/core/database/data/tables.sql
index 0eae219b..2a8f0ab3 100644
--- a/Sources/src/data/core/database/db.sql
+++ b/Sources/src/data/core/database/data/tables.sql
@@ -103,30 +103,5 @@ CREATE TABLE FrequenceCardiaque (
FOREIGN KEY (activiteId) REFERENCES Activite(idActivite)
);
-INSERT INTO Athlete (idAthlete, nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach) VALUES
- (1, 'Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01', FALSE),
- (2, 'Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02', TRUE);
-
-INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES
- (1, 2, '2023-01-01');
-
-INSERT INTO Notification (idNotif, message, date, statut, urgence, athleteId) VALUES
- (1, 'Training session at 10 AM', '2023-03-10', TRUE, 1, 1);
-
-INSERT INTO Statistique (idStatistique, poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES
- (1, 70, 80, 150, 500, '2023-03-10', 1);
-
-INSERT INTO Entrainement (idEntrainement, date, description, latitude, longitude, feedback, athleteId) VALUES
- (1, '2023-03-12', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1);
-
-INSERT INTO Participe (athleteId, entrainementId) VALUES
- (1, 1);
-
-INSERT INTO SourceDonnee (idSource, type, modele, precision2, athleteId) VALUES
- (1, 'Heart Rate Monitor', 'HRM-Pro', 98.5, 1);
-
-INSERT INTO Activite (idActivite, type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES
- (1, 'Running', '2023-03-10', '08:00:00', '09:00:00', 7, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1);
-
-INSERT INTO FrequenceCardiaque (idFc, altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES
- (1, 100, '08:15:00', 15, 130, -74.0060, 40.7128, 1);
+\i athlete.sql
+\i friendship.sql
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000..b143d20d
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,28 @@
+{
+ "name": "Web",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "dependencies": {
+ "chart.js": "^4.4.1"
+ }
+ },
+ "node_modules/@kurkle/color": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
+ "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw=="
+ },
+ "node_modules/chart.js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.1.tgz",
+ "integrity": "sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==",
+ "dependencies": {
+ "@kurkle/color": "^0.3.0"
+ },
+ "engines": {
+ "pnpm": ">=7"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 00000000..3df43b72
--- /dev/null
+++ b/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "chart.js": "^4.4.1"
+ }
+}