matplobbot-shared 0.1.35__py3-none-any.whl → 0.1.37__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matplobbot-shared
3
- Version: 0.1.35
3
+ Version: 0.1.37
4
4
  Summary: Shared library for the Matplobbot ecosystem (database, services, i18n).
5
5
  Author: Ackrome
6
6
  Author-email: ivansergeyevich@gmail.com
@@ -1,11 +1,11 @@
1
1
  shared_lib/__init__.py,sha256=Wxuw1wbvCOsKqs6WfIQ05cx_vndhPs6rH2krMatFRqA,45
2
- shared_lib/database.py,sha256=1vJYxybYKnQYfP-Eir4-EK02AHtEmUfiVz-gsxm1fE4,22019
2
+ 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=GcZQk8l-iVxm2HhbokHQpBgI4-M0K6CtJE1VljfhgZU,4494
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.35.dist-info/METADATA,sha256=45SJabegi3aZqiGTICtOkRqSl6hw43yZIpGy0w72XOo,416
9
- matplobbot_shared-0.1.35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- matplobbot_shared-0.1.35.dist-info/top_level.txt,sha256=L8mrC50YWCe19jmh_zrUZFvXSkhsnES5K6y027G1838,11
11
- matplobbot_shared-0.1.35.dist-info/RECORD,,
8
+ matplobbot_shared-0.1.37.dist-info/METADATA,sha256=mkBv_2DRbzUWz3UCyHO05HK5wLXLbslPkna7tYYpAHo,416
9
+ matplobbot_shared-0.1.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ matplobbot_shared-0.1.37.dist-info/top_level.txt,sha256=L8mrC50YWCe19jmh_zrUZFvXSkhsnES5K6y027G1838,11
11
+ matplobbot_shared-0.1.37.dist-info/RECORD,,
shared_lib/database.py CHANGED
@@ -108,16 +108,12 @@ async def init_db():
108
108
  entity_id TEXT NOT NULL,
109
109
  entity_name TEXT NOT NULL,
110
110
  notification_time TIME NOT NULL,
111
- last_schedule_hash TEXT,
112
111
  is_active BOOLEAN DEFAULT TRUE,
112
+ last_schedule_hash TEXT, -- Added here for consistency
113
113
  UNIQUE(user_id, entity_type, entity_id)
114
114
  )
115
115
  ''')
116
116
  # Add the last_schedule_hash column if it doesn't exist, for backward compatibility
117
- await connection.execute('''
118
- ALTER TABLE user_schedule_subscriptions
119
- ADD COLUMN IF NOT EXISTS last_schedule_hash TEXT;
120
- ''')
121
117
  logger.info("Database tables initialized.")
122
118
 
123
119
  async def log_user_action(user_id: int, username: str | None, full_name: str, avatar_pic_url: str | None, action_type: str, action_details: str | None):
@@ -5,6 +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 hcode
8
9
 
9
10
  from shared_lib.i18n import translator
10
11
 
@@ -36,12 +37,12 @@ def format_schedule(schedule_data: List[Dict[str, Any]], lang: str, entity_name:
36
37
  for date_str, lessons in sorted(days.items()):
37
38
  date_obj = datetime.strptime(date_str, "%Y-%m-%d").date()
38
39
 
39
- day_header = f"*{date_obj.strftime('%A, %d.%m.%Y')}*"
40
+ day_header = f"<b>{date_obj.strftime('%A, %d.%m.%Y')}</b>"
40
41
 
41
42
  formatted_lessons = []
42
43
  for lesson in sorted(lessons, key=lambda x: x['beginLesson']):
43
44
  lesson_details = [
44
- f"`{lesson['beginLesson']} - {lesson['endLesson']} | {lesson['auditorium']}`",
45
+ hcode(f"{lesson['beginLesson']} - {lesson['endLesson']} | {lesson['auditorium']}"),
45
46
  f"{lesson['discipline']} | {names_shorter[lesson['kindOfWork']]}"
46
47
  ]
47
48