From 7ef1931331c6cfc880adfc26503f683b1fae8502 Mon Sep 17 00:00:00 2001 From: dymik739 Date: Sun, 26 Feb 2023 10:28:31 +0200 Subject: [PATCH] auto-schedule-pro: add pair ending time --- modules/auto-schedule-pro/index.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/auto-schedule-pro/index.py b/modules/auto-schedule-pro/index.py index 1e37a4d..39c7a6c 100644 --- a/modules/auto-schedule-pro/index.py +++ b/modules/auto-schedule-pro/index.py @@ -68,6 +68,7 @@ if self.MESSAGE["text"].lower() == "!пара": print("test3.1") actual_pair_ts = reference_time + min(full_schedule.keys()) dt_pair = datetime.datetime.fromtimestamp(actual_pair_ts) + dt_pair_finish = datetime.datetime.fromtimestamp(actual_pair_ts + 5400) p = full_schedule[min(full_schedule.keys())] print("test3.1.1") @@ -85,15 +86,21 @@ if self.MESSAGE["text"].lower() == "!пара": print("test3.1.2") + ''' if int(dt_pair.strftime("%H")) == 11: human_readable_date += "об " else: human_readable_date += "о " + ''' + human_readable_date += "з " print("test3.1.3") human_readable_date += dt_pair.strftime("%H:%M") print("test3.1.4") + human_readable_date += " до " + human_readable_date += dt_pair_finish.strftime("%H:%M") + self.RESPONCE = "Актуальна пара: {}\nДата: {}\nВикладач: {}\nПосилання на пару: {}".format(p['name'], human_readable_date, p['teacher'], p['link']) print("test3.1.5") else: @@ -103,6 +110,7 @@ if self.MESSAGE["text"].lower() == "!пара": print("test3.2") actual_pair_ts = reference_time + next_pair_time dt_pair = datetime.datetime.fromtimestamp(actual_pair_ts) + dt_pair_finish = datetime.datetime.fromtimestamp(actual_pair_ts + 5400) print(f"Debug: selected pair at {next_pair_time}") print(f"{current_day} == 6 && {dt_pair.strftime('%u')} == 1") @@ -117,11 +125,16 @@ if self.MESSAGE["text"].lower() == "!пара": else: human_readable_date += "сьогодні " + ''' if int(dt_pair.strftime("%H")) == 11: human_readable_date += "об " else: human_readable_date += "о " - + ''' + human_readable_date += "з " human_readable_date += dt_pair.strftime("%H:%M") - + + human_readable_date += " до " + human_readable_date += dt_pair_finish.strftime("%H:%M") + self.RESPONCE = "Актуальна пара: {}\nДата: {}\nВикладач: {}\nПосилання на пару: {}".format(p['name'], human_readable_date, p['teacher'], p['link'])