|
@@ 44-74 (lines=31) @@
|
| 41 |
|
* @param Request $request |
| 42 |
|
* @return Response |
| 43 |
|
*/ |
| 44 |
|
public function weightAction(Request $request) |
| 45 |
|
{ |
| 46 |
|
$dateRangeType = new DateRangeType(); |
| 47 |
|
|
| 48 |
|
$dateRangeForm = $this->createForm($dateRangeType, array( |
| 49 |
|
'from' => $this->getDefaultFrom('-1 week'), |
| 50 |
|
'to' => $this->getDefaultTo(), |
| 51 |
|
)); |
| 52 |
|
|
| 53 |
|
$dateRangeForm->handleRequest($request); |
| 54 |
|
$dateRangeFormData = $dateRangeForm->getData(); |
| 55 |
|
|
| 56 |
|
$from = $dateRangeFormData['from']; |
| 57 |
|
$to = $dateRangeFormData['to']; |
| 58 |
|
|
| 59 |
|
/** @var DayRepository $repo */ |
| 60 |
|
$repo = $this->getRepositoryForClass(Day::class); |
| 61 |
|
|
| 62 |
|
$days = $repo->getInRange($from, $to, $this->getUser()); |
| 63 |
|
$allDays = $this->getDaysOrNull($days, $from, $to); |
| 64 |
|
|
| 65 |
|
$minWeight = $this->getMinWeight($days); |
| 66 |
|
$maxWeight = $this->getMaxWeight($days); |
| 67 |
|
|
| 68 |
|
return $this->render('@DominikzoggEnergyCalculator/Chart/weight.html.twig', array( |
| 69 |
|
'daterangeform' => $dateRangeForm->createView(), |
| 70 |
|
'alldays' => $allDays, |
| 71 |
|
'minweight' => $minWeight, |
| 72 |
|
'maxweight' => $maxWeight, |
| 73 |
|
)); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** |
| 77 |
|
* @Route("/calorie", bind="chart_calorie", method="GET") |
|
@@ 81-111 (lines=31) @@
|
| 78 |
|
* @param Request $request |
| 79 |
|
* @return Response |
| 80 |
|
*/ |
| 81 |
|
public function caloriesAction(Request $request) |
| 82 |
|
{ |
| 83 |
|
$dateRangeType = new DateRangeType(); |
| 84 |
|
|
| 85 |
|
$dateRangeForm = $this->createForm($dateRangeType, array( |
| 86 |
|
'from' => $this->getDefaultFrom('-1 week'), |
| 87 |
|
'to' => $this->getDefaultTo(), |
| 88 |
|
)); |
| 89 |
|
|
| 90 |
|
$dateRangeForm->handleRequest($request); |
| 91 |
|
$dateRangeFormData = $dateRangeForm->getData(); |
| 92 |
|
|
| 93 |
|
$from = $dateRangeFormData['from']; |
| 94 |
|
$to = $dateRangeFormData['to']; |
| 95 |
|
|
| 96 |
|
/** @var DayRepository $repo */ |
| 97 |
|
$repo = $this->getRepositoryForClass(Day::class); |
| 98 |
|
|
| 99 |
|
$days = $repo->getInRange($from, $to, $this->getUser()); |
| 100 |
|
$allDays = $this->getDaysOrNull($days, $from, $to); |
| 101 |
|
|
| 102 |
|
$minCalorie = $this->getMinCalorie($days); |
| 103 |
|
$maxCalorie = $this->getMaxCalorie($days); |
| 104 |
|
|
| 105 |
|
return $this->render('@DominikzoggEnergyCalculator/Chart/calorie.html.twig', array( |
| 106 |
|
'daterangeform' => $dateRangeForm->createView(), |
| 107 |
|
'alldays' => $allDays, |
| 108 |
|
'mincalorie' => $minCalorie, |
| 109 |
|
'maxcalorie' => $maxCalorie, |
| 110 |
|
)); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
/** |
| 114 |
|
* @Route("/energymix", bind="chart_energymix", method="GET") |
|
@@ 118-148 (lines=31) @@
|
| 115 |
|
* @param Request $request |
| 116 |
|
* @return Response |
| 117 |
|
*/ |
| 118 |
|
public function energymixAction(Request $request) |
| 119 |
|
{ |
| 120 |
|
$dateRangeType = new DateRangeType(); |
| 121 |
|
|
| 122 |
|
$dateRangeForm = $this->createForm($dateRangeType, array( |
| 123 |
|
'from' => $this->getDefaultFrom('-1 week'), |
| 124 |
|
'to' => $this->getDefaultTo(), |
| 125 |
|
)); |
| 126 |
|
|
| 127 |
|
$dateRangeForm->handleRequest($request); |
| 128 |
|
$dateRangeFormData = $dateRangeForm->getData(); |
| 129 |
|
|
| 130 |
|
$from = $dateRangeFormData['from']; |
| 131 |
|
$to = $dateRangeFormData['to']; |
| 132 |
|
|
| 133 |
|
/** @var DayRepository $repo */ |
| 134 |
|
$repo = $this->getRepositoryForClass(Day::class); |
| 135 |
|
|
| 136 |
|
$days = $repo->getInRange($from, $to, $this->getUser()); |
| 137 |
|
$allDays = $this->getDaysOrNull($days, $from, $to); |
| 138 |
|
|
| 139 |
|
$minEnergyMix = $this->getMinEnergyMix($days); |
| 140 |
|
$maxEnergyMix = $this->getMaxEnergyMix($days); |
| 141 |
|
|
| 142 |
|
return $this->render('@DominikzoggEnergyCalculator/Chart/energymix.html.twig', array( |
| 143 |
|
'daterangeform' => $dateRangeForm->createView(), |
| 144 |
|
'alldays' => $allDays, |
| 145 |
|
'minenergymix' => $minEnergyMix, |
| 146 |
|
'maxenergymix' => $maxEnergyMix, |
| 147 |
|
)); |
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
/** |
| 151 |
|
* @param string|null $modifier |