From 005d504538c6328dbc5ec2e81950f4f7a89a1568 Mon Sep 17 00:00:00 2001 From: Yariv Menachem Date: Tue, 31 Dec 2024 17:50:26 +0200 Subject: [PATCH] check if --- src/telegram_handler/telegram_default_handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/telegram_handler/telegram_default_handler.py b/src/telegram_handler/telegram_default_handler.py index 2764a15..0fab146 100644 --- a/src/telegram_handler/telegram_default_handler.py +++ b/src/telegram_handler/telegram_default_handler.py @@ -25,7 +25,7 @@ def map_jobs_to_keyboard(jobs: list[JobPost]) -> InlineKeyboardMarkup: keyboard = [] for job in jobs: # Create a new inner list for each job - inner_list = [InlineKeyboardButton(job.title, callback_data=job.id)] + inner_list = [InlineKeyboardButton(f"{job.title},{job.company_name}", callback_data=job.id)] # Append the inner list to the main keyboard list keyboard.append(inner_list) @@ -67,7 +67,9 @@ class TelegramDefaultHandler(TelegramHandler): old_jobs, new_jobs = self.jobRepository.insert_many_if_not_found(jobs) for newJob in new_jobs: await self.telegram_bot.send_job(newJob) - await self.telegram_bot.send_text("filtered by title: ", reply_markup=map_jobs_to_keyboard(filtered_out_jobs)) + if filtered_out_jobs: + await self.telegram_bot.send_text("filtered by title: ", + reply_markup=map_jobs_to_keyboard(filtered_out_jobs)) self.logger.info(f"Found {len(old_jobs)} old jobs") await self.telegram_bot.send_text( f"Finished scarping: {site_names_print}")