auto-schedule-pro: add pair ending time

This commit is contained in:
dymik739 2023-02-26 10:28:31 +02:00
parent 83e19452a0
commit 7ef1931331
1 changed files with 15 additions and 2 deletions

View File

@ -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'])