matplobbot-shared 0.1.36__tar.gz → 0.1.38__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matplobbot-shared
3
- Version: 0.1.36
3
+ Version: 0.1.38
4
4
  Summary: Shared library for the Matplobbot ecosystem (database, services, i18n).
5
5
  Author: Ackrome
6
6
  Author-email: ivansergeyevich@gmail.com
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matplobbot-shared
3
- Version: 0.1.36
3
+ Version: 0.1.38
4
4
  Summary: Shared library for the Matplobbot ecosystem (database, services, i18n).
5
5
  Author: Ackrome
6
6
  Author-email: ivansergeyevich@gmail.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="matplobbot-shared",
5
- version="0.1.36", # Let's use the version from your requirements.txt
5
+ version="0.1.38", # Let's use the version from your requirements.txt
6
6
  packages=find_packages(include=['shared_lib', 'shared_lib.*']),
7
7
  description="Shared library for the Matplobbot ecosystem (database, services, i18n).",
8
8
  author="Ackrome",
@@ -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 escape_md
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"*{date_obj.strftime('%A, %d.%m.%Y')}*"
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"`{lesson['beginLesson']} - {lesson['endLesson']} | {lesson['auditorium']}`",
53
- f"{discipline} | {kind_of_work}"
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"{lecturer}\n{lecturer_email}")
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} | {lecturer}\n{lecturer_email}")
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"{lecturer}")
56
+ lesson_details.append(f"{lesson['lecturer_title'].replace('_',' ')}")
64
57
 
65
58
  formatted_lessons.append("\n".join(lesson_details))
66
59