matplobbot-shared 0.1.36__py3-none-any.whl → 0.1.38__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of matplobbot-shared might be problematic. Click here for more details.
- {matplobbot_shared-0.1.36.dist-info → matplobbot_shared-0.1.38.dist-info}/METADATA +1 -1
- {matplobbot_shared-0.1.36.dist-info → matplobbot_shared-0.1.38.dist-info}/RECORD +5 -5
- shared_lib/services/schedule_service.py +8 -15
- {matplobbot_shared-0.1.36.dist-info → matplobbot_shared-0.1.38.dist-info}/WHEEL +0 -0
- {matplobbot_shared-0.1.36.dist-info → matplobbot_shared-0.1.38.dist-info}/top_level.txt +0 -0
|
@@ -3,9 +3,9 @@ shared_lib/database.py,sha256=lEIqM8e68RH8BCGVKk8dbZ-8JYIVB7c6l8AfhNPbYfg,21877
|
|
|
3
3
|
shared_lib/i18n.py,sha256=VBWQWVF-k_HDiidYo_RUPyUCM7oL897z5hOw9jvOoYY,1762
|
|
4
4
|
shared_lib/redis_client.py,sha256=j7AKwrSWhtEHeV25Sy0JiWLIx2EI3hFEx7suoOwxRU8,2234
|
|
5
5
|
shared_lib/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
shared_lib/services/schedule_service.py,sha256=
|
|
6
|
+
shared_lib/services/schedule_service.py,sha256=jDbanvTdHgtKI2vR7HXLQ73Rk8gu3bPHdazHhfRSpho,4545
|
|
7
7
|
shared_lib/services/university_api.py,sha256=Ui-zjfKOHCCf2Imh8CNtVOWegwuep7IB8gO9IKNUrrE,1898
|
|
8
|
-
matplobbot_shared-0.1.
|
|
9
|
-
matplobbot_shared-0.1.
|
|
10
|
-
matplobbot_shared-0.1.
|
|
11
|
-
matplobbot_shared-0.1.
|
|
8
|
+
matplobbot_shared-0.1.38.dist-info/METADATA,sha256=9jAVxzDnfo5k_j3Sc-bTgslKyVEOKxkoTo0Cpk7xvU0,416
|
|
9
|
+
matplobbot_shared-0.1.38.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
matplobbot_shared-0.1.38.dist-info/top_level.txt,sha256=L8mrC50YWCe19jmh_zrUZFvXSkhsnES5K6y027G1838,11
|
|
11
|
+
matplobbot_shared-0.1.38.dist-info/RECORD,,
|
|
@@ -5,7 +5,7 @@ from datetime import datetime, date, time
|
|
|
5
5
|
from collections import defaultdict
|
|
6
6
|
from ics import Calendar, Event
|
|
7
7
|
from zoneinfo import ZoneInfo
|
|
8
|
-
from aiogram.utils.markdown import
|
|
8
|
+
from aiogram.utils.markdown import hcode
|
|
9
9
|
|
|
10
10
|
from shared_lib.i18n import translator
|
|
11
11
|
|
|
@@ -37,30 +37,23 @@ def format_schedule(schedule_data: List[Dict[str, Any]], lang: str, entity_name:
|
|
|
37
37
|
for date_str, lessons in sorted(days.items()):
|
|
38
38
|
date_obj = datetime.strptime(date_str, "%Y-%m-%d").date()
|
|
39
39
|
|
|
40
|
-
day_header = f"
|
|
40
|
+
day_header = f"<b>{date_obj.strftime('%A, %d.%m.%Y')}</b>"
|
|
41
41
|
|
|
42
42
|
formatted_lessons = []
|
|
43
43
|
for lesson in sorted(lessons, key=lambda x: x['beginLesson']):
|
|
44
|
-
# Escape all dynamic parts to prevent markdown parsing errors
|
|
45
|
-
discipline = escape_md(lesson['discipline'])
|
|
46
|
-
kind_of_work = escape_md(names_shorter[lesson['kindOfWork']])
|
|
47
|
-
lecturer = escape_md(lesson['lecturer_title'].replace('_',' '))
|
|
48
|
-
lecturer_email = escape_md(lesson.get('lecturerEmail', 'Почта не указана'))
|
|
49
|
-
group = escape_md(lesson.get('group', 'Группа не указана'))
|
|
50
|
-
|
|
51
44
|
lesson_details = [
|
|
52
|
-
f"
|
|
53
|
-
f"{discipline} | {
|
|
45
|
+
hcode(f"{lesson['beginLesson']} - {lesson['endLesson']} | {lesson['auditorium']}"),
|
|
46
|
+
f"{lesson['discipline']} | {names_shorter[lesson['kindOfWork']]}"
|
|
54
47
|
]
|
|
55
48
|
|
|
56
49
|
if entity_type == 'group':
|
|
57
|
-
lesson_details.append(f"{
|
|
50
|
+
lesson_details.append(f"{lesson['lecturer_title'].replace('_',' ')}\n{lesson.get('lecturerEmail', 'Почта не указана')}")
|
|
58
51
|
elif entity_type == 'person': # Lecturer
|
|
59
|
-
lesson_details.append(f" {group}")
|
|
52
|
+
lesson_details.append(f" {lesson.get('group', 'Группа не указана')}")
|
|
60
53
|
elif entity_type == 'auditorium':
|
|
61
|
-
lesson_details.append(f"{group} | {
|
|
54
|
+
lesson_details.append(f"{lesson.get('group', 'Группа не указана')} | {lesson['lecturer_title'].replace('_',' ')}\n{lesson.get('lecturerEmail', 'Почта не указана')}")
|
|
62
55
|
else: # Fallback to a generic format
|
|
63
|
-
lesson_details.append(f"{
|
|
56
|
+
lesson_details.append(f"{lesson['lecturer_title'].replace('_',' ')}")
|
|
64
57
|
|
|
65
58
|
formatted_lessons.append("\n".join(lesson_details))
|
|
66
59
|
|
|
File without changes
|
|
File without changes
|