diff options
author | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-03-03 19:26:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-03 19:26:13 +0300 |
commit | 86e957d53ec0d47ee8f8ca406e9322d6dc0a6ac6 (patch) | |
tree | 30543dd96d71497db722c231420e5244406d1a9c /partners_api | |
parent | eebf71851ae22ef768020c85f4f6a885cb4601ac (diff) | |
parent | 29e16988f6c18d005385ef12a09b35b3195a88c2 (diff) |
Merge pull request #5512 from milchakov/booking_facilities_format
Booking facilities format changed (core part)
Diffstat (limited to 'partners_api')
-rw-r--r-- | partners_api/booking_api.cpp | 12 | ||||
-rw-r--r-- | partners_api/booking_api.hpp | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/partners_api/booking_api.cpp b/partners_api/booking_api.cpp index 5bdf73e5f2..e01cb5be05 100644 --- a/partners_api/booking_api.cpp +++ b/partners_api/booking_api.cpp @@ -92,11 +92,13 @@ vector<HotelFacility> ParseFacilities(json_t const * facilitiesArray) for (size_t i = 0; i < sz; ++i) { - auto item = json_array_get(facilitiesArray, i); + auto itemArray = json_array_get(facilitiesArray, i); + ASSERT(json_is_array(itemArray), ()); + ASSERT_EQUAL(json_array_size(itemArray), 2, ()); HotelFacility facility; - my::FromJSONObject(item, "type", facility.m_facilityType); - my::FromJSONObject(item, "name", facility.m_name); + my::FromJSON(json_array_get(itemArray, 0), facility.m_type); + my::FromJSON(json_array_get(itemArray, 1), facility.m_name); facilities.push_back(move(facility)); } @@ -158,7 +160,7 @@ vector<HotelReview> ParseReviews(json_t const * reviewsArray) review.m_date = system_clock::from_time_t(mktime(&t)); double score; - my::FromJSONObject(item, "average_score", score); + my::FromJSONObject(item, "score", score); review.m_score = static_cast<float>(score); my::FromJSONObject(item, "author", review.m_author); @@ -177,7 +179,7 @@ void FillHotelInfo(string const & src, HotelInfo & info) my::FromJSONObjectOptionalField(root.get(), "description", info.m_description); double score; - my::FromJSONObjectOptionalField(root.get(), "average_score", score); + my::FromJSONObjectOptionalField(root.get(), "score", score); info.m_score = static_cast<float>(score); json_int_t scoreCount = 0; diff --git a/partners_api/booking_api.hpp b/partners_api/booking_api.hpp index 370cb14602..1efbee1c1e 100644 --- a/partners_api/booking_api.hpp +++ b/partners_api/booking_api.hpp @@ -29,7 +29,7 @@ struct HotelReview struct HotelFacility { - string m_facilityType; + string m_type; string m_name; }; |