Fix Tao
This commit is contained in:
parent
2a5d6d3fce
commit
ae641886fd
@ -12,6 +12,8 @@ find_library(Restbed restbed
|
|||||||
find_library(Curl curl
|
find_library(Curl curl
|
||||||
PATHS /usr/lib)
|
PATHS /usr/lib)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
|
||||||
|
|
||||||
project(LunchRest)
|
project(LunchRest)
|
||||||
|
|
||||||
list(APPEND Restaurants
|
list(APPEND Restaurants
|
||||||
|
@ -10,6 +10,9 @@ std::pair<size_t, size_t> getPricePosFromText(const std::string &text) {
|
|||||||
price_pos = possible_price;
|
price_pos = possible_price;
|
||||||
possible_price = text.find('k', possible_price + 1);
|
possible_price = text.find('k', possible_price + 1);
|
||||||
}
|
}
|
||||||
|
if(price_pos == 0 || price_pos == std::string::npos) {
|
||||||
|
return {-1, -1};
|
||||||
|
}
|
||||||
auto end_pos = price_pos;
|
auto end_pos = price_pos;
|
||||||
price_pos -= 1;
|
price_pos -= 1;
|
||||||
while (text[price_pos] >= '0' && text[price_pos] <= '9') {
|
while (text[price_pos] >= '0' && text[price_pos] <= '9') {
|
||||||
@ -57,6 +60,10 @@ void LunchRest::TaoRestaurant::parse() {
|
|||||||
if (!texts.empty()) {
|
if (!texts.empty()) {
|
||||||
auto text = nodeToText(texts[0]);
|
auto text = nodeToText(texts[0]);
|
||||||
auto price_positions = getPricePosFromText(text);
|
auto price_positions = getPricePosFromText(text);
|
||||||
|
if(price_positions.first == (size_t)-1) {
|
||||||
|
week_meals.emplace_back(false, text, "", 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
auto end_pos = getEndOfTextPos(text, price_positions.first);
|
auto end_pos = getEndOfTextPos(text, price_positions.first);
|
||||||
week_meals.emplace_back(
|
week_meals.emplace_back(
|
||||||
false, text.substr(0, end_pos), "",
|
false, text.substr(0, end_pos), "",
|
||||||
@ -71,6 +78,9 @@ void LunchRest::TaoRestaurant::parse() {
|
|||||||
auto text = nodeToText(texts[0]);
|
auto text = nodeToText(texts[0]);
|
||||||
auto day = nodeToText(days[0]);
|
auto day = nodeToText(days[0]);
|
||||||
auto price_positions = getPricePosFromText(text);
|
auto price_positions = getPricePosFromText(text);
|
||||||
|
if(price_positions.first == (size_t)-1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
auto end_pos = getEndOfTextPos(text, price_positions.first);
|
auto end_pos = getEndOfTextPos(text, price_positions.first);
|
||||||
|
|
||||||
int cur_day = 0;
|
int cur_day = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user