Fixed generator.

This commit is contained in:
VladiMihaylenko 2017-09-27 13:55:51 +03:00 committed by Ilya Grechuhin
parent 208fe1926a
commit c3810529c7
3 changed files with 7 additions and 7 deletions

View file

@ -47,7 +47,7 @@ UNIT_TEST(UGC_TranslateRatingTest)
bool rc = tr.TranslateUGC(id, ugc);
TEST(rc, ("Can't translate rating for", id));
TEST_EQUAL(ugc.m_rating.m_ratings.size(), 1, ());
TEST_EQUAL(ugc.m_rating.m_ratings[0].m_key, "TranslationKey14", ());
TEST_EQUAL(ugc.m_rating.m_ratings[0].m_value, 4.0, ());
TEST_EQUAL(ugc.m_ratings.size(), 1, ());
TEST_EQUAL(ugc.m_ratings[0].m_key, "TranslationKey14", ());
TEST_EQUAL(ugc.m_ratings[0].m_value, 4.0, ());
}

View file

@ -15,7 +15,7 @@ UGCTranslator::UGCTranslator(std::string const & path)
bool UGCTranslator::TranslateUGC(osm::Id const & id, ugc::UGC & ugc)
{
bool ratingsOk = TranslateRating(m_dbRatings, id, ugc.m_rating);
bool ratingsOk = TranslateRatings(m_dbRatings, id, ugc.m_ratings);
bool reviewsOk = TranslateReview(m_dbReviews, id, ugc.m_reviews);
return ratingsOk && reviewsOk;
}
@ -32,7 +32,7 @@ void UGCTranslator::CreateReviews(std::string const & data)
UNUSED_VALUE(rc);
}
bool UGCTranslator::TranslateRating(UGCDB & db, osm::Id const id, ugc::Rating & rating)
bool UGCTranslator::TranslateRatings(UGCDB & db, osm::Id const id, ugc::Ratings & ratings)
{
std::vector<uint8_t> blob;
bool rc = db.Get(id, blob);
@ -54,7 +54,7 @@ bool UGCTranslator::TranslateRating(UGCDB & db, osm::Id const id, ugc::Rating &
std::ostringstream translationKey;
translationKey << "TranslationKey" << translationKeyId;
rating.m_ratings.emplace_back(translationKey.str(), static_cast<float>(ratingValue));
ratings.emplace_back(translationKey.str(), static_cast<float>(ratingValue));
}
return true;

View file

@ -19,7 +19,7 @@ public:
void CreateReviews(std::string const & data);
private:
bool TranslateRating(UGCDB & db, osm::Id const id, ugc::Rating & rating);
bool TranslateRatings(UGCDB & db, osm::Id const id, ugc::Ratings & ratings);
bool TranslateReview(UGCDB & db, osm::Id const id, std::vector<ugc::Review> & review);
// bool TranslateAttribute(UGCDB & db, osm::Id const id, ugc::Attribute & attribute);