From a62fdd949182ccd8013e6dda1e6e688108247918 Mon Sep 17 00:00:00 2001 From: Christiaan Goossens Date: Mon, 3 Apr 2017 18:17:26 +0200 Subject: [PATCH] Testrapport #5 fix --- src/Application/Statistieken.php | 29 +++++++++++++++++++---------- templates/statistieken.phtml | 14 ++++++++++++++ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/Application/Statistieken.php b/src/Application/Statistieken.php index e307a45..ef9c0bb 100644 --- a/src/Application/Statistieken.php +++ b/src/Application/Statistieken.php @@ -19,19 +19,28 @@ use Inforbank\Application\Helper\Header; use Inforbank\Application\Helper\Statistieken as StatistiekenHelper; use Slim\App; -class Statistieken { +class Statistieken +{ public function __construct(App $app) { $app->get('/statistieken/{rekeningnummer}', function ($request, $response, $args) { - $verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']); - return $this->renderer->render($response, "statistieken.phtml", [ - "header" => Header::getHeaderData(), - "rekeningnr" => $args['rekeningnummer'], - "statistieken" => [ - "x-as" => $verloop['x-as'], - "y-as" => $verloop['y-as'] - ] - ]); + try { + $verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']); + return $this->renderer->render($response, "statistieken.phtml", [ + "header" => Header::getHeaderData(), + "rekeningnr" => $args['rekeningnummer'], + "statistieken" => [ + "x-as" => $verloop['x-as'], + "y-as" => $verloop['y-as'] + ] + ]); + } catch (\Exception $e) { + return $this->renderer->render($response, "statistieken.phtml", [ + "header" => Header::getHeaderData(), + "rekeningnr" => $args['rekeningnummer'], + "statistieken" => false + ]); + } })->add(new Middleware()); } } diff --git a/templates/statistieken.phtml b/templates/statistieken.phtml index 933ed79..46b7db1 100644 --- a/templates/statistieken.phtml +++ b/templates/statistieken.phtml @@ -1,4 +1,15 @@ + + + + + + Terug