@@ -113,7 +113,7 @@ |
||
| 113 | 113 | 'factories' => [ |
| 114 | 114 | Controller\DistributionReportController::class => Factory\DistributionReportControllerFactory::class, |
| 115 | 115 | Controller\EvolutionReportController::class => Factory\EvolutionReportControllerFactory::class, |
| 116 | - Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
| 116 | + Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
| 117 | 117 | ], |
| 118 | 118 | ], |
| 119 | 119 | 'view_manager' => [ |
@@ -24,4 +24,4 @@ |
||
| 24 | 24 | ], |
| 25 | 25 | ], |
| 26 | 26 | ]; |
| 27 | - |
|
| 28 | 27 | \ No newline at end of file |
| 28 | + |
|
| 29 | 29 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | $activities = $this->entityManager->getRepository(Emission::class) |
| 38 | - ->findAll(); |
|
| 38 | + ->findAll(); |
|
| 39 | 39 | var_dump($activities); |
| 40 | 40 | return new JsonModel($activities); |
| 41 | 41 | |
@@ -236,37 +236,37 @@ discard block |
||
| 236 | 236 | /** |
| 237 | 237 | * |
| 238 | 238 | */ |
| 239 | - public function getGasesDistributionAction() |
|
| 240 | - { |
|
| 241 | - $params = $this->params()->fromRoute(); |
|
| 239 | + public function getGasesDistributionAction() |
|
| 240 | + { |
|
| 241 | + $params = $this->params()->fromRoute(); |
|
| 242 | 242 | |
| 243 | - $ano = (int)$params['ano']; |
|
| 243 | + $ano = (int)$params['ano']; |
|
| 244 | 244 | |
| 245 | - $response = []; |
|
| 245 | + $response = []; |
|
| 246 | 246 | |
| 247 | - $sql = 'SELECT e.gas_id, g.nombre, g.color, sum(e.valor) as total |
|
| 247 | + $sql = 'SELECT e.gas_id, g.nombre, g.color, sum(e.valor) as total |
|
| 248 | 248 | FROM emision e |
| 249 | 249 | LEFT JOIN gas g ON (e.gas_id = g.id) |
| 250 | 250 | where e.ano = ? GROUP BY e.gas_id ORDER BY total DESC'; |
| 251 | 251 | |
| 252 | - $parameters = [ |
|
| 252 | + $parameters = [ |
|
| 253 | 253 | $ano, |
| 254 | 254 | ]; |
| 255 | 255 | |
| 256 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 256 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 257 | 257 | |
| 258 | - $results = $statement->execute(); |
|
| 258 | + $results = $statement->execute(); |
|
| 259 | 259 | |
| 260 | - $response['gases'][] = 'x'; |
|
| 261 | - $response['valores'][] = 'Gases'; |
|
| 260 | + $response['gases'][] = 'x'; |
|
| 261 | + $response['valores'][] = 'Gases'; |
|
| 262 | 262 | |
| 263 | - while ($a = $results->next()) { |
|
| 264 | - $response['gases'][] = (strpos($a['nombre'], ',')) ? '"'.$a['nombre'].'"' : $a['nombre']; |
|
| 265 | - $response['valores'][] = round($a['total']); |
|
| 266 | - $response['colores'][] = $a['color']; |
|
| 267 | - } |
|
| 268 | - return new JsonModel($response); |
|
| 269 | - } |
|
| 263 | + while ($a = $results->next()) { |
|
| 264 | + $response['gases'][] = (strpos($a['nombre'], ',')) ? '"'.$a['nombre'].'"' : $a['nombre']; |
|
| 265 | + $response['valores'][] = round($a['total']); |
|
| 266 | + $response['colores'][] = $a['color']; |
|
| 267 | + } |
|
| 268 | + return new JsonModel($response); |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | 271 | public function getSectoralGasesDistributionAction() |
| 272 | 272 | { |
@@ -6,14 +6,14 @@ |
||
| 6 | 6 | |
| 7 | 7 | class EmissionRepository extends EntityRepository |
| 8 | 8 | { |
| 9 | - public function findAllBySector($year) |
|
| 10 | - { |
|
| 11 | - return $this->createQueryBuilder() |
|
| 12 | - ->from() |
|
| 13 | - ->join() |
|
| 14 | - ->where() |
|
| 15 | - ->groupBy() |
|
| 16 | - ->setParameter() |
|
| 17 | - ->getResult(':year', $year); |
|
| 18 | - } |
|
| 9 | + public function findAllBySector($year) |
|
| 10 | + { |
|
| 11 | + return $this->createQueryBuilder() |
|
| 12 | + ->from() |
|
| 13 | + ->join() |
|
| 14 | + ->where() |
|
| 15 | + ->groupBy() |
|
| 16 | + ->setParameter() |
|
| 17 | + ->getResult(':year', $year); |
|
| 18 | + } |
|
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |