From b03fceb3ddf6ca518030be322e0b9a81844d1ac3 Mon Sep 17 00:00:00 2001 From: zvon Date: Sun, 20 Sep 2020 16:43:13 +0200 Subject: [PATCH] Add support for sat/sun --- restaurant.hpp | 8 +++++--- restaurants/alcapone.cpp | 4 ++++ restaurants/suzzies.cpp | 2 -- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/restaurant.hpp b/restaurant.hpp index 4ed0d04..f8700fc 100644 --- a/restaurant.hpp +++ b/restaurant.hpp @@ -10,7 +10,7 @@ public: Restaurant() = delete; Restaurant(const std::string &url, const std::string &restaurant) : _url(url), _restaurant(restaurant) { - menus.resize(5); + menus.resize(7); } virtual ~Restaurant() = default; const std::vector &getMenus() { @@ -22,7 +22,7 @@ public: virtual void parse() = 0; void clearMenus() { menus.clear(); - menus.resize(5); + menus.resize(7); for(auto &x : menus) x.setInvalidMenu(); menus[0].setDay("Monday"); @@ -30,8 +30,10 @@ public: menus[2].setDay("Wednesday"); menus[3].setDay("Thursday"); menus[4].setDay("Friday"); + menus[5].setDay("Saturday"); + menus[6].setDay("Sunday"); } - std::string jsonify(const std::vector &days = {0,1,2,3,4}) { + std::string jsonify(const std::vector &days = {0,1,2,3,4,5,6}) { std::stringstream ss{}; ss << "{\"restaurant\": \"" << getRestaurant() << "\", \"dailymenus\": ["; bool comma = false; diff --git a/restaurants/alcapone.cpp b/restaurants/alcapone.cpp index 2dd999e..1e8f348 100644 --- a/restaurants/alcapone.cpp +++ b/restaurants/alcapone.cpp @@ -32,6 +32,10 @@ void LunchRest::AlCaponeRestaurant::parse() { cur_day = 3; else if(day.find("pátek") != std::string::npos) cur_day = 4; + else if(day.find("sobota") != std::string::npos) + cur_day = 5; + else if(day.find("neděle") != std::string::npos) + cur_day = 6; menus[cur_day].setInvalidMenu(false); continue; } diff --git a/restaurants/suzzies.cpp b/restaurants/suzzies.cpp index 45894f8..4df7831 100644 --- a/restaurants/suzzies.cpp +++ b/restaurants/suzzies.cpp @@ -29,8 +29,6 @@ void LunchRest::SuzziesRestaurant::parse() { for(size_t i = 0; i < json_menus.Size(); i++) { const auto &menu = json_menus[i]["daily_menu"]; auto week_day = weekDay(menu["start_date"].GetString()); - if(week_day > 4) - continue; menus[week_day].setInvalidMenu(false); const auto &meals = menu["dishes"]; for(size_t j = 0; j < meals.Size(); j++) {