| 38 | using Iter = typename vector<string>::iterator; |
| 39 | |
| 40 | void MatchTracks(MwmToTracks const & mwmToTracks, storage::Storage const & storage, NumMwmIds const & numMwmIds, |
| 41 | MwmToMatchedTracks & mwmToMatchedTracks) |
| 42 | { |
| 43 | base::Timer timer; |
| 44 | |
| 45 | uint64_t tracksCount = 0; |
| 46 | uint64_t pointsCount = 0; |
| 47 | uint64_t nonMatchedPointsCount = 0; |
| 48 | |
| 49 | auto processMwm = [&](string const & mwmName, UserToTrack const & userToTrack) |
| 50 | { |
| 51 | auto const countryFile = platform::CountryFile(mwmName); |
| 52 | auto const mwmId = numMwmIds.GetId(countryFile); |
| 53 | TrackMatcher matcher(storage, mwmId, countryFile); |
| 54 | |
| 55 | auto & userToMatchedTracks = mwmToMatchedTracks[mwmId]; |
| 56 | |
| 57 | for (auto const & it : userToTrack) |
| 58 | { |
| 59 | string const & user = it.first; |
| 60 | auto & matchedTracks = userToMatchedTracks[user]; |
| 61 | try |
| 62 | { |
| 63 | matcher.MatchTrack(it.second, matchedTracks); |
| 64 | } |
| 65 | catch (RootException const & e) |
| 66 | { |
| 67 | LOG(LERROR, ("Can't match track for mwm:", mwmName, ", user:", user)); |
| 68 | LOG(LERROR, (" ", e.what())); |
| 69 | } |
| 70 | |
| 71 | if (matchedTracks.empty()) |
| 72 | userToMatchedTracks.erase(user); |
| 73 | } |
| 74 | |
| 75 | if (userToMatchedTracks.empty()) |
| 76 | mwmToMatchedTracks.erase(mwmId); |
| 77 | |
| 78 | tracksCount += matcher.GetTracksCount(); |
| 79 | pointsCount += matcher.GetPointsCount(); |
| 80 | nonMatchedPointsCount += matcher.GetNonMatchedPointsCount(); |
| 81 | |
| 82 | LOG(LINFO, |
| 83 | (numMwmIds.GetFile(mwmId).GetName(), ", users:", userToTrack.size(), ", tracks:", matcher.GetTracksCount(), |
| 84 | ", points:", matcher.GetPointsCount(), ", non matched points:", matcher.GetNonMatchedPointsCount())); |
| 85 | }; |
| 86 | |
| 87 | ForTracksSortedByMwmName(mwmToTracks, numMwmIds, processMwm); |
| 88 | |
| 89 | LOG(LINFO, ("Matching finished, elapsed:", timer.ElapsedSeconds(), "seconds, tracks:", tracksCount, |
| 90 | ", points:", pointsCount, ", non matched points:", nonMatchedPointsCount)); |
| 91 | } |
| 92 | } // namespace |
| 93 | |
| 94 | namespace track_analyzing |
no test coverage detected