diff --git a/Sources/src/app/controller/UserController.php b/Sources/src/app/controller/UserController.php index f2047f5a..e97dd508 100644 --- a/Sources/src/app/controller/UserController.php +++ b/Sources/src/app/controller/UserController.php @@ -9,6 +9,7 @@ use App\Router\Response\Response; use App\Router\Response\IResponse; use App\Router\Session; +use DateTime; use Manager\UserManager; use Shared\Attributes\Route; use Shared\Validation; @@ -51,26 +52,24 @@ class UserController extends BaseController { $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'])]; + + $charts = []; + $i = 0; + while ($i <= 12) { + if ($activity[$i]['mois'] == null) { + $activity[$i]['mois'] = $i; + $activity[$i]['nbactivite'] = 0; + } elseif (($indice = intval($activity[$i]['mois'])) != $i) { + $temp = $activity[$i]; // Stocker temporairement les données actuelles + $activity[$i]['mois'] = $i; + $activity[$i]['nbactivite'] = 0; + $activity[$indice]['mois'] = $indice; + $activity[$indice]['nbactivite'] = $temp['nbactivite']; // Restaurer les données + } + $charts[] = ['act' => $activity[$i]['nbactivite'], 'mois' => $activity[$i]['mois']]; + $i++; } -// $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", @@ -78,7 +77,7 @@ class UserController extends BaseController 'role' => "Athlète", 'friendship' => [], 'analyzes' => [], - 'chart' => $chart, + 'charts' => $charts, '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 e14809bc..89e9607b 100644 --- a/Sources/src/app/views/Templates/page/activity.html.twig +++ b/Sources/src/app/views/Templates/page/activity.html.twig @@ -67,7 +67,6 @@ {{analyze.max}} Bpm {{analyze.min}} Bpm {{analyze.temperature}} °C - {{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 712b9708..e42396bf 100755 --- a/Sources/src/app/views/Templates/page/analyze.html.twig +++ b/Sources/src/app/views/Templates/page/analyze.html.twig @@ -17,36 +17,36 @@
- - - - - - - - - - - - - - - {% for analyze in analyzes %} - - - - - - - - - - - - - - {% endfor %} -
id FCaltitudetempsTemperaturebpmlongitudelatitudeactiviteid
{{analyze.idfc}}{{analyze.altitude}}{{analyze.temps}}{{analyze.temperature}}{{analyze.bpm}}{{analyze.longitude}}{{analyze.latitude}}{{analyze.activiteid}}Home
+{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# {% for analyze in analyzes %}#} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# #} +{# {% endfor %}#} +{#
id FCaltitudetempsTemperaturebpmlongitudelatitudeactiviteid
{{analyze.idfc}}{{analyze.altitude}}{{analyze.temps}}{{analyze.temperature}}{{analyze.bpm}}{{analyze.longitude}}{{analyze.latitude}}{{analyze.activiteid}}Home
#} {#
#} {# #} {#

Hello Fallback World

#} @@ -84,7 +84,7 @@ {# });#} {# #}
- +

Hello Fallback World

@@ -109,7 +109,10 @@ datasets: [{ label: 'Batement par minute', data: data, - borderWidth: 1 + borderWidth: 1, + tension: 0.2, + fill: false, + borderColor: 'rgb(255, 0, 0)' }] }, options: { diff --git a/Sources/src/app/views/Templates/page/home.html.twig b/Sources/src/app/views/Templates/page/home.html.twig index d626f45f..e7df9548 100755 --- a/Sources/src/app/views/Templates/page/home.html.twig +++ b/Sources/src/app/views/Templates/page/home.html.twig @@ -21,55 +21,88 @@ Stastiques globales
- -
- +
+ +

Hello Fallback World

+
+ + -{# #} + {#new Chart(ctx, {#} + {# type: 'line',#} + {# data: {#} + {# labels: labels,#} + {# datasets: [{#} + {# label: 'Activité du mois',#} + {# data: data,#} + {# borderWidth: 1,#} + {# tension: 0.2,#} + {# fill: false,#} + {# borderColor: 'rgb(255, 0, 0)'#} + {# }]#} + {# },#} + {# options: {#} + {# scales: {#} + {# y: {#} + {# beginAtZero: true#} + {# }#} + {# }#} + {# }#} + {#});#} +