diff --git a/modules/auto-schedule-pro-v2/main.py b/modules/auto-schedule-pro-v2/main.py
index a3840a8..777daa6 100644
--- a/modules/auto-schedule-pro-v2/main.py
+++ b/modules/auto-schedule-pro-v2/main.py
@@ -158,26 +158,43 @@ def get_name_of_lesson_type(lesson_type):
def generate_lesson_description(lesson, start_datetime, end_datetime, current_day, current_week, overrides={},
- custom_name_prefix="Назва", template="legacy-vibrant"):
+ custom_name_prefix="Назва", template="legacy-vibrant", force_date_at_top=False):
# temporarily not supported
#output_settings = {"name": True, "date": True, "teacher": True, "link": True, "comment": True}
#output_settings.update(overrides)
if lesson.__class__ == dict:
- active_template = load_template(template, "single")
+ if force_date_at_top:
+ total_result = load_template(template, "date")
+ human_readable_date = get_human_readable_date(start_datetime, end_datetime,
+ current_day, current_week)
+ total_result = total_result.replace("%DATE%", human_readable_date)
- for i in ['name', 'teacher', 'link']:
- active_template = active_template.replace(f"%{i.upper()}%", lesson[i])
+ total_result += load_template(template, "multiple")
+ for i in ['name', 'teacher', 'link']:
+ total_result = total_result.replace(f"%{i.upper()}%", lesson[i])
+
+ total_result = total_result.replace("%DATE%", human_readable_date)
+ total_result = total_result.replace("%TYPE%", get_name_of_lesson_type(lesson['type']))
+ total_result = total_result.replace("%NAME_PREFIX%", custom_name_prefix)
+
+ return total_result + "\n"
+
+ else:
+ active_template = load_template(template, "single")
+
+ for i in ['name', 'teacher', 'link']:
+ active_template = active_template.replace(f"%{i.upper()}%", lesson[i])
- human_readable_date = get_human_readable_date(start_datetime, end_datetime,
+ human_readable_date = get_human_readable_date(start_datetime, end_datetime,
current_day, current_week)
- active_template = active_template.replace("%DATE%", human_readable_date)
- active_template = active_template.replace("%TYPE%", get_name_of_lesson_type(lesson['type']))
- active_template = active_template.replace("%NAME_PREFIX%", custom_name_prefix)
+ active_template = active_template.replace("%DATE%", human_readable_date)
+ active_template = active_template.replace("%TYPE%", get_name_of_lesson_type(lesson['type']))
+ active_template = active_template.replace("%NAME_PREFIX%", custom_name_prefix)
- return active_template
+ return active_template
elif lesson.__class__ == list:
total_result = load_template(template, "date")
@@ -247,14 +264,15 @@ def process_arguments(args, base_day):
def get_lesson_description(schedule, reference_time, lesson_time, current_day, current_week, overrides={},
- custom_name_prefix="Назва", template="legacy-vibrant"):
+ custom_name_prefix="Назва", template="legacy-vibrant", force_date_at_top=False):
lesson_record = schedule[lesson_time]
lesson_start_datetime = datetime.fromtimestamp(reference_time + lesson_time)
lesson_end_datetime = datetime.fromtimestamp(reference_time + lesson_time + 5400)
return generate_lesson_description(lesson_record, lesson_start_datetime, lesson_end_datetime, current_day,
- current_week, overrides=overrides, custom_name_prefix=custom_name_prefix, template=template)
+ current_week, overrides=overrides, custom_name_prefix=custom_name_prefix, template=template,
+ force_date_at_top=force_date_at_top)
def process(message, path):
@@ -325,7 +343,7 @@ def process(message, path):
lesson_list = [i for i in schedule if selected_day * 86400 <= i < (selected_day + 1) * 86400]
lesson_descriptions_list = [get_lesson_description(schedule, reference_time, lesson_time, current_day,
- current_week, overrides=preferences, custom_name_prefix="Назва", template=output_style_preference)
+ current_week, overrides=preferences, custom_name_prefix="Назва", template=output_style_preference, force_date_at_top=True)
for lesson_time in lesson_list]
return f"Пари у {WEEKDAYS_ACCUSATIVE[selected_day % 7]}:\n\n\n" + "\n".join(lesson_descriptions_list), "HTML"
diff --git a/modules/auto-schedule-pro-v2/templates/legacy/date.msg b/modules/auto-schedule-pro-v2/templates/legacy/date.msg
index 5cdc8e1..dfd8af3 100644
--- a/modules/auto-schedule-pro-v2/templates/legacy/date.msg
+++ b/modules/auto-schedule-pro-v2/templates/legacy/date.msg
@@ -1 +1 @@
-%DATE%:
+%DATE%: