|
8 | 8 | #include "render/main_menu/view.hpp" |
9 | 9 | #include "render/recipes_suggestions/view.hpp" |
10 | 10 | #include "render/storage/view.hpp" |
11 | | -#include "render/storages_selection/view.hpp" |
12 | 11 | #include "utils/ingredients_availability.hpp" |
13 | 12 | #include "utils/parsing.hpp" |
14 | 13 |
|
15 | 14 | #include <optional> |
16 | 15 | #include <stdexcept> |
17 | 16 | #include <string> |
| 17 | +#include <string_view> |
18 | 18 | #include <utility> |
19 | 19 | #include <variant> |
20 | 20 | #include <vector> |
21 | 21 |
|
22 | 22 | namespace cookcookhnya::handlers::recipes_suggestions { |
23 | 23 |
|
24 | 24 | using namespace render::recipes_suggestions; |
25 | | -using namespace render::select_storages; |
26 | 25 | using namespace render::storage; |
27 | 26 | using namespace render::cooking_planning; |
28 | 27 | using namespace render::main_menu; |
29 | 28 | using namespace api::models::storage; |
30 | 29 | using namespace std::views; |
| 30 | +using namespace std::literals; |
31 | 31 |
|
32 | 32 | void handleSuggestedRecipesListCQ( |
33 | 33 | SuggestedRecipesList& state, CallbackQueryRef cq, BotRef bot, SMRef stateManager, api::ApiClientRef api) { |
@@ -56,16 +56,18 @@ void handleSuggestedRecipesListCQ( |
56 | 56 | } |
57 | 57 |
|
58 | 58 | if (data.starts_with("recipe_")) { |
59 | | - auto recipeId = utils::parseSafe<api::RecipeId>(data.substr(sizeof("recipe_") - 1)); |
| 59 | + auto recipeId = utils::parseSafe<api::RecipeId>(std::string_view{data}.substr("recipe_"sv.size())); |
60 | 60 | if (!recipeId) |
61 | 61 | return; |
62 | 62 |
|
63 | 63 | std::vector<CookingPlanning::IngredientAvailability> inStorage = |
64 | 64 | utils::inStoragesAvailability(state.getStorageIds(), *recipeId, userId, api); |
65 | 65 |
|
66 | 66 | renderCookingPlanning(inStorage, *recipeId, userId, chatId, bot, api); |
67 | | - stateManager.put(CookingPlanning{ |
68 | | - .prevState = std::move(state), .addedStorages = {}, .availability = inStorage, .recipeId = *recipeId}); |
| 67 | + stateManager.put(CookingPlanning{.prevState = std::move(state), |
| 68 | + .addedStorages = {}, |
| 69 | + .availability = std::move(inStorage), |
| 70 | + .recipeId = *recipeId}); |
69 | 71 | return; |
70 | 72 | } |
71 | 73 |
|
|
0 commit comments