|
|
@@ -733,34 +733,28 @@ async fn callback_handler(q: CallbackQuery, bot: Bot, dialogue: QIFDialogue) ->
|
|
|
filename,
|
|
|
item,
|
|
|
category: _,
|
|
|
- mut items_left,
|
|
|
+ items_left,
|
|
|
mut items_processed,
|
|
|
}) = state
|
|
|
{
|
|
|
- items_processed.insert(item, data.to_string()); // Ensure the correct type is inserted
|
|
|
- if let Some(newitem) = items_left.pop() {
|
|
|
- bot.send_message(chat.id, format!("Input category to search for {}", newitem))
|
|
|
- .await?;
|
|
|
- dialogue
|
|
|
- .update(State::CategorySelect {
|
|
|
- filename,
|
|
|
- item: newitem,
|
|
|
- items_left,
|
|
|
- items_processed,
|
|
|
- })
|
|
|
- .await?;
|
|
|
- } else {
|
|
|
+ items_processed.insert(item, data.to_string());
|
|
|
+ if items_left.is_empty() {
|
|
|
bot.send_message(chat.id, "This was the last item!").await?;
|
|
|
- bot.send_message(chat.id, "Items are categorized and categories are updated")
|
|
|
+ bot.send_message(chat.id, "Items are categorized, and categories are updated")
|
|
|
+ .await?;
|
|
|
+ // Call create_categories_keyboard here with items_processed to generate the keyboard
|
|
|
+ let keyboard = create_categories_keyboard(&items_processed);
|
|
|
+ bot.send_message(chat.id, "Enter the memo line")
|
|
|
+ .reply_markup(keyboard)
|
|
|
.await?;
|
|
|
- // Assuming create_categories_keyboard is defined elsewhere and correctly processes items_processed
|
|
|
- bot.send_message(chat.id, "Enter the memo line").await?;
|
|
|
dialogue
|
|
|
.update(State::Ready {
|
|
|
filename,
|
|
|
item_categories: items_processed,
|
|
|
})
|
|
|
.await?;
|
|
|
+ } else {
|
|
|
+ log::warn!("Items left when callback called");
|
|
|
}
|
|
|
} else {
|
|
|
log::info!("No SubCategory match!");
|