From 90677b494e88db016165da26307f01e290b9e6e2 Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Thu, 31 Mar 2016 11:11:24 +0300 Subject: [PATCH] More details to close routing statistics. --- map/framework.cpp | 9 ++------- routing/routing_session.cpp | 19 +++++++++++++++++++ routing/routing_session.hpp | 2 ++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/map/framework.cpp b/map/framework.cpp index bfbd6f115e..ed7d0e6964 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -523,7 +523,7 @@ void Framework::OnMapDeregistered(platform::LocalCountryFile const & localFile) }; // Call action on thread in which the framework was created - // For more information look at comment for Observer class in mwm_set.hpp + // For more information look at comment for Observer class in mwm_set.hpp if (m_storage.GetThreadChecker().CalledOnOriginalThread()) action(); else @@ -2235,12 +2235,7 @@ void Framework::CloseRouting() { if (m_routingSession.IsBuilt()) { - auto const lastGoodPoint = MercatorBounds::ToLatLon( - m_routingSession.GetRoute().GetFollowedPolyline().GetCurrentIter().m_pt); - alohalytics::Stats::Instance().LogEvent( - "RouteTracking_RouteClosing", - {{"percent", strings::to_string(m_routingSession.GetCompletionPercent())}}, - alohalytics::Location::FromLatLon(lastGoodPoint.lat, lastGoodPoint.lon)); + m_routingSession.EmitCloseRoutingEvent(); } m_routingSession.Reset(); RemoveRoute(true /* deactivateFollowing */); diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index 4d239f4cdf..36115d69fa 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -500,4 +500,23 @@ double RoutingSession::GetDistanceToCurrentCamM(SpeedCameraRestriction & camera, } return kInvalidSpeedCameraDistance; } + +void RoutingSession::EmitCloseRoutingEvent() const +{ + if (!m_route.IsValid()) + { + ASSERT(false, ()); + return; + } + auto const lastGoodPoint = + MercatorBounds::ToLatLon(m_route.GetFollowedPolyline().GetCurrentIter().m_pt); + alohalytics::Stats::Instance().LogEvent( + "RouteTracking_RouteClosing", + {{"percent", strings::to_string(GetCompletionPercent())}, + {"distance", strings::to_string(m_passedDistanceOnRouteMeters + + m_route.GetCurrentDistanceToEndMeters())}, + {"router", m_route.GetRouterId()}, + {"rebuildCount", strings::to_string(m_routingRebuildCount)}}, + alohalytics::Location::FromLatLon(lastGoodPoint.lat, lastGoodPoint.lon)); +} } // namespace routing diff --git a/routing/routing_session.hpp b/routing/routing_session.hpp index b0ed984dac..036f16ffde 100644 --- a/routing/routing_session.hpp +++ b/routing/routing_session.hpp @@ -123,6 +123,8 @@ public: void GenerateTurnNotifications(vector & turnNotifications); double GetCompletionPercent() const; + void EmitCloseRoutingEvent() const; + private: struct DoReadyCallback {