From 9155d089cb69639614dd08d7b92cdcd73c3e4105 Mon Sep 17 00:00:00 2001 From: Dmitry Gavriloff Date: Tue, 31 Jan 2017 10:32:27 +0400 Subject: [PATCH] Issue #116 9 (#246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Добавил проверку с максимальным значением acr * issue #116 Добавил тек. точку в лог --- src/Kubikvest/Handler/Checkpoint.php | 11 +++++++++++ .../Resource/Checkpoint/Respondent.php | 4 ++++ src/Kubikvest/Resource/Checkpoint/Response.php | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/src/Kubikvest/Handler/Checkpoint.php b/src/Kubikvest/Handler/Checkpoint.php index acf2a89..1f7a850 100644 --- a/src/Kubikvest/Handler/Checkpoint.php +++ b/src/Kubikvest/Handler/Checkpoint.php @@ -62,9 +62,20 @@ public function handle(Request $request) $point = $pointBuilder->build($group->getPointId()); $response = new Resource\Checkpoint\Response($this->app); + $response->setPosition($position); $response->setPoint($point); $response->setQuest($quest); + $this->app['logger']->log( + \Psr\Log\LogLevel::INFO, + 'Текущая точка', + [ + 'PointId' => $point->getPointId(), + 'PointLat' => $point->getSector()->getLatitudeRange()->getMin() . " - " . $point->getSector()->getLatitudeRange()->getMax(), + 'PointLng' => $point->getSector()->getLongitudeRange()->getMin() . " - " . $point->getSector()->getLongitudeRange()->getMax(), + ] + ); + $this->app['logger']->log( \Psr\Log\LogLevel::INFO, 'Расстояния до точек', diff --git a/src/Kubikvest/Resource/Checkpoint/Respondent.php b/src/Kubikvest/Resource/Checkpoint/Respondent.php index ebd0c53..c8d62aa 100644 --- a/src/Kubikvest/Resource/Checkpoint/Respondent.php +++ b/src/Kubikvest/Resource/Checkpoint/Respondent.php @@ -42,6 +42,10 @@ public function response() 'quest' => $this->response->getQuest(), 'point' => $this->response->getPoint(), 'error' => $this->response->error, + 'coords' => [ + 'lat' => $this->response->getPosition()->getCoordinate()->getLatitude(), + 'lng' => $this->response->getPosition()->getCoordinate()->getLongitude(), + ], ]; $data['total_points'] = $data['quest']['total_points']; diff --git a/src/Kubikvest/Resource/Checkpoint/Response.php b/src/Kubikvest/Resource/Checkpoint/Response.php index 973d33d..70a6390 100644 --- a/src/Kubikvest/Resource/Checkpoint/Response.php +++ b/src/Kubikvest/Resource/Checkpoint/Response.php @@ -20,6 +20,7 @@ use Kubikvest\Model\User; use Kubikvest\Resource\Point\Model\Point; +use Kubikvest\Resource\Position\Model\Position; use Kubikvest\Resource\Quest\Model\Quest; use Silex\Application; @@ -34,6 +35,7 @@ class Response public $error = false; protected $quest; protected $point; + protected $position; /** * @var User */ @@ -127,4 +129,20 @@ public function getPoint() { return $this->point; } + + /** + * @return Position + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param Position $position + */ + public function setPosition($position) + { + $this->position = $position; + } }