| 2034 | } |
| 2035 | |
| 2036 | Progress Storage::CalculateProgress(CountriesVec const & descendants) const |
| 2037 | { |
| 2038 | // Function calculates progress correctly ONLY if |downloadingMwm| is leaf. |
| 2039 | |
| 2040 | Progress result; |
| 2041 | |
| 2042 | auto const mwmsInQueue = GetQueuedCountries(m_downloader->GetQueue()); |
| 2043 | for (auto const & d : descendants) |
| 2044 | { |
| 2045 | auto const downloadingIt = m_downloadingCountries.find(d); |
| 2046 | if (downloadingIt != m_downloadingCountries.cend()) |
| 2047 | { |
| 2048 | if (!downloadingIt->second.IsUnknown()) |
| 2049 | result.m_bytesDownloaded += downloadingIt->second.m_bytesDownloaded; |
| 2050 | |
| 2051 | result.m_bytesTotal += GetRemoteSize(GetCountryFile(d)); |
| 2052 | } |
| 2053 | else if (mwmsInQueue.count(d) != 0) |
| 2054 | { |
| 2055 | result.m_bytesTotal += GetRemoteSize(GetCountryFile(d)); |
| 2056 | } |
| 2057 | else if (m_justDownloaded.count(d) != 0) |
| 2058 | { |
| 2059 | MwmSize const localCountryFileSz = GetRemoteSize(GetCountryFile(d)); |
| 2060 | result.m_bytesDownloaded += localCountryFileSz; |
| 2061 | result.m_bytesTotal += localCountryFileSz; |
| 2062 | } |
| 2063 | } |
| 2064 | |
| 2065 | return result; |
| 2066 | } |
| 2067 | |
| 2068 | void Storage::UpdateNode(CountryId const & countryId) |
| 2069 | { |
nothing calls this directly
no test coverage detected