diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-02-12 16:36:20 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-02-12 16:36:20 +0200 |
| commit | 5fef5f1fc5312e0c2c6788adf5c81ec275361cc8 (patch) | |
| tree | d9b0b47820b2a8ee4c0d86c35d20af4fe32dad97 /hommaexceli_py/telegram_client.py | |
| parent | 909ce794a8d6d4c207d5b96c0200c8bde326e8be (diff) | |
Implement date filtering logic
Diffstat (limited to 'hommaexceli_py/telegram_client.py')
| -rw-r--r-- | hommaexceli_py/telegram_client.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/hommaexceli_py/telegram_client.py b/hommaexceli_py/telegram_client.py index 2d30b01..34a750c 100644 --- a/hommaexceli_py/telegram_client.py +++ b/hommaexceli_py/telegram_client.py @@ -6,7 +6,7 @@ from os import getenv from telegram.ext import Updater, CommandHandler, Job from telegram import Update from sheets_client import authenticate_and_fetch_sheets_data -from parser import process_rows +from parser import filter_only_this_weeks_rows chats_mem_cache = set() @@ -28,10 +28,12 @@ def _callback_alarm(context): rows = authenticate_and_fetch_sheets_data() logging.info(f"Processing data...") - processed_data = process_rows(rows) + processed_data = filter_only_this_weeks_rows(rows) logging.info(f"Sending sheet data to chat id {chat_id}...") - message = "\n".join(map(str, processed_data)) + message = "Tällä viikolla tehtävät hommat:\n" + "\n".join( + map(lambda task: f"{task[1]} ({task[2]})", processed_data) + ) context.bot.send_message(chat_id=chat_id, text=message) |
