From 8128caab066ca068e202b7ea6211f060804d9545 Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sat, 12 Mar 2022 14:22:52 +0300
Subject: [PATCH 01/15] FEATURES ADDED + HOTFIX v1.4 #11

---
 Course_1/Telegram_Bot/Buttons.py | 14 +++++++-------
 Course_1/Telegram_Bot/bot.py     | 33 +++++++++++++++++---------------
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/Course_1/Telegram_Bot/Buttons.py b/Course_1/Telegram_Bot/Buttons.py
index 4367787..15f7f54 100644
--- a/Course_1/Telegram_Bot/Buttons.py
+++ b/Course_1/Telegram_Bot/Buttons.py
@@ -3,13 +3,13 @@
 
 answer_start = ReplyKeyboardMarkup(resize_keyboard=True).add("Получить задание!").add('Управление заданиями')
 Inline_Date = InlineKeyboardMarkup(inline_keyboard=True, row_width=3)
-Inline_Date_Week = InlineKeyboardButton(text='🥶 Вся неделя 🥶', callback_data='Inline_Date_Week')
-Inline_Date_Bm = InlineKeyboardButton(text='💀 понедельник 💀', callback_data='Inline_Date_Bm')
-Inline_Date_Bt = InlineKeyboardButton(text='🤯 Вторник 🤯', callback_data='Inline_Date_Bt')
-Inline_Date_Bwd = InlineKeyboardButton(text='😒 Среда 😒', callback_data='Inline_Date_Bwd')
-Inline_Date_Bth = InlineKeyboardButton(text='🤨 Четверг 🤨', callback_data='Inline_Date_Bth')
-Inline_Date_Bf = InlineKeyboardButton(text='🍺 Пятница 🍺', callback_data='Inline_Date_Bf')
-Inline_Date_Sn = InlineKeyboardButton(text='😎 Суббота 😎', callback_data='Inline_Date_BSn')
+Inline_Date_Week = InlineKeyboardButton(text='Вся неделя 🥶', callback_data='Inline_Date_Week')
+Inline_Date_Bm = InlineKeyboardButton(text='понедельник 💀', callback_data='Inline_Date_Bm')
+Inline_Date_Bt = InlineKeyboardButton(text='Вторник 🤯', callback_data='Inline_Date_Bt')
+Inline_Date_Bwd = InlineKeyboardButton(text='Среда 😒', callback_data='Inline_Date_Bwd')
+Inline_Date_Bth = InlineKeyboardButton(text='Четверг 🤨', callback_data='Inline_Date_Bth')
+Inline_Date_Bf = InlineKeyboardButton(text='Пятница 🍺', callback_data='Inline_Date_Bf')
+Inline_Date_Sn = InlineKeyboardButton(text='Суббота 😎', callback_data='Inline_Date_BSn')
 Inline_Date_Down = InlineKeyboardButton(text='⏬', callback_data='Inline_Date_Down')
 Inline_Date_Up = InlineKeyboardButton(text='⏫', callback_data='Inline_Date_Up')
 Inline_Manage = InlineKeyboardMarkup(inline_keyboard=True)
diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index 4c75bef..b2be460 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -26,6 +26,15 @@ class SelfState(StatesGroup):
 dp = Dispatcher(bot, storage=storage)
 db = Database()
 
+days_of_week = {
+	1: 'Понедельник',
+	2: 'Вторник',
+	3: 'Среда',
+	4: 'Четверг',
+	5: 'Пятница',
+	6: 'Суббота'
+}
+
 
 @dp.message_handler(commands=['start'], state="*")
 async def process_start_command(message: types.Message):
@@ -99,6 +108,7 @@ async def edit_homework(message: types.Message, state: FSMContext):
 	text = message.text.split()
 	if len(text) < 2 or all(map(lambda x: len(x) > 3, text)):
 		await message.answer_sticker(sticker='CAACAgIAAxkBAAEEG9BiKojK_SZBFl_KqTqswln3CM1ptQAC7xMAApJeSUuQKkME9nIP_SME')
+		await state.finish()
 		return 0
 	Subject, Date = text[0], text[1]
 	if db.is_exists(date=Date, subject_name=Subject):
@@ -123,6 +133,7 @@ async def edit_homework(message: types.Message, state: FSMContext):
 
 @dp.callback_query_handler(lambda query: query.data.split('_')[2][0] == 'B')
 async def homework_reply(query: types.CallbackQuery, state: FSMContext):
+	day = query.data.split("_")[2]
 	try:
 		async with state.proxy() as data:
 			date_count = data['date_count']
@@ -136,8 +147,8 @@ async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 			'BSn': 5
 		}
 		date_to_db = [
-			(start_date + timedelta(days=days[query.data.split('_')[2]])).strftime('%d.%m.%y'),
-			(start_date + timedelta(days=days[query.data.split('_')[2]])).strftime('%d.%m.%Y')]
+			(start_date + timedelta(days=days[day])).strftime('%d.%m.%y'),
+			(start_date + timedelta(days=days[day])).strftime('%d.%m.%Y')]
 		if db.is_available_homework_by_date(date=date_to_db[0]) or db.is_available_homework_by_date(date=date_to_db[1]):
 			date_to_db = date_to_db[0] if db.is_available_homework_by_date(date=date_to_db[0]) else date_to_db[1]
 			available_homework = db.is_available_homework_by_date(date=date_to_db, data=True)
@@ -145,7 +156,7 @@ async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 			for num, subject in enumerate(available_homework):
 				__text += f'{str(num + 1)}) ' + subject[0].capitalize() + ': ' + subject[1] + '\n'
 			await query.message.answer(
-				text=f'`{date_to_db}\nДисциплины с заполненным домашним заданием:`*\n{__text}*',
+				text=f'*📅 {days_of_week[days[day] + 1]} {date_to_db}*\n`{__text}`',
 				parse_mode='markdown'
 			)
 			try:
@@ -154,7 +165,7 @@ async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 				print('Какое-то сообщение не удаляется(')
 		else:
 			await query.message.answer(
-				text='*Никто не заполнил домашние задания на этот день* 😭', parse_mode='markdown'
+				text='*Никто не заполнил домашнее задания на этот день* 😭', parse_mode='markdown'
 			)
 
 	except KeyError:
@@ -178,14 +189,6 @@ async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 		async with state.proxy() as data:
 			date_count = data['date_count']
 		start_date = week_definition(date_count, debug=True)
-		days_of_week = {
-			1: 'Понедельник',
-			2: 'Вторник',
-			3: 'Среда',
-			4: 'Четверг',
-			5: 'Пятница',
-			6: 'Суббота'
-		}
 		for day in range(6):
 			current_day = (start_date + timedelta(days=day)).strftime('%d.%m.%Y')
 			available_homework = db.is_available_homework_by_date(date=current_day, data=True)
@@ -200,11 +203,11 @@ async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 				__text += \
 					f'{str(num + 1)}) ' + subject[0].capitalize() + ': ' + subject[1] + '\n'
 			if not __text:
-				__text = '*Никто не заполнил домашние задания на этот день* 😭'
+				__text = '*Никто не заполнил домашнее задания на этот день* 😭'
 			else:
 				__text = '`' + __text + '`'
 			await call.message.answer(
-				text=f'*📅 {days_of_week[day + 1]} {current_day} 📅*\n{__text}',
+				text=f'*📅 {days_of_week[day + 1]} {current_day}*\n{__text}',
 				parse_mode='markdown')
 	except KeyError:
 		await process_start_command(call.message)
@@ -219,7 +222,7 @@ async def callback_down(call: types.CallbackQuery, state: FSMContext):
 		await bot.edit_message_text(
 			chat_id=call.message.chat.id,
 			message_id=call.message.message_id,
-			text=f"*Выбираем дату \n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
+			text=f"*Выбираем день недели \n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
 			parse_mode="markdown",
 			reply_markup=Buttons.Inline_Date)
 	except KeyError:

From d8a04045eb2d582b26eab05d9d17f38dd0034744 Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sat, 12 Mar 2022 15:45:34 +0300
Subject: [PATCH 02/15] DATABASE UPDATE + HOTFIX v1.5 #11

---
 Course_1/Telegram_Bot/bot.py | 30 +++++++++++++++++++++---------
 Course_1/Telegram_Bot/db.py  | 27 ++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index b2be460..0a172a6 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -17,6 +17,7 @@
 
 
 class SelfState(StatesGroup):
+	Group_state = State()
 	Add_state = State()
 	Edit_state = State()
 
@@ -24,7 +25,8 @@ class SelfState(StatesGroup):
 storage = MemoryStorage()
 bot = Bot(token=TOKEN)
 dp = Dispatcher(bot, storage=storage)
-db = Database()
+HDB = Database()
+UDB = Database.UsersDB()
 
 days_of_week = {
 	1: 'Понедельник',
@@ -38,7 +40,17 @@ class SelfState(StatesGroup):
 
 @dp.message_handler(commands=['start'], state="*")
 async def process_start_command(message: types.Message):
-	await message.answer("Привет! Нажми на кнопку, чтобы получить домашнее задание.", reply_markup=Buttons.answer_start)
+	await message.answer("Привет! Для получения задания - введи номер своей группы.\n\n Например: ПИ21-7")
+	await SelfState.Group_state.set()
+
+
+@dp.message_handler(state=SelfState.Group_state)
+async def group_state_command(message: types.Message, state: FSMContext):
+	await state.finish()
+	await message.answer("Нажми на кнопку, чтобы получить домашнее задание.", reply_markup=Buttons.answer_start)
+	chat_id = message.chat.id
+	user_group = message.text
+	UDB.add_user(chat_id=chat_id, user_group=user_group)
 
 
 @dp.message_handler(lambda message: message.text == 'Управление заданиями', state="*")
@@ -81,7 +93,7 @@ async def add_homework(message: types.Message, state: FSMContext):
 	Subject, Date, Exercise = text[0], text[1], ' '.join(text[2:])
 	await message.answer(
 		text='*{}*'.format(
-			db.add_homework(
+			HDB.add_homework(
 				subject_name=Subject,
 				date=Date, text=Exercise,
 				username=message.from_user.username)),
@@ -111,7 +123,7 @@ async def edit_homework(message: types.Message, state: FSMContext):
 		await state.finish()
 		return 0
 	Subject, Date = text[0], text[1]
-	if db.is_exists(date=Date, subject_name=Subject):
+	if HDB.is_exists(date=Date, subject_name=Subject):
 		print(message.from_user.username, 'отредактировал:\n', text)
 		await bot.edit_message_text(
 			chat_id=message.chat.id,
@@ -123,7 +135,7 @@ async def edit_homework(message: types.Message, state: FSMContext):
 			chat_id=message.chat.id,
 			message_id=message.message_id
 		)
-		db.delete_homework(subject_name=Subject, date=Date)
+		HDB.delete_homework(subject_name=Subject, date=Date)
 		await state.finish()
 		await SelfState.Add_state.set()
 	else:
@@ -149,9 +161,9 @@ async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 		date_to_db = [
 			(start_date + timedelta(days=days[day])).strftime('%d.%m.%y'),
 			(start_date + timedelta(days=days[day])).strftime('%d.%m.%Y')]
-		if db.is_available_homework_by_date(date=date_to_db[0]) or db.is_available_homework_by_date(date=date_to_db[1]):
-			date_to_db = date_to_db[0] if db.is_available_homework_by_date(date=date_to_db[0]) else date_to_db[1]
-			available_homework = db.is_available_homework_by_date(date=date_to_db, data=True)
+		if HDB.is_available_homework_by_date(date=date_to_db[0]) or HDB.is_available_homework_by_date(date=date_to_db[1]):
+			date_to_db = date_to_db[0] if HDB.is_available_homework_by_date(date=date_to_db[0]) else date_to_db[1]
+			available_homework = HDB.is_available_homework_by_date(date=date_to_db, data=True)
 			__text = str()
 			for num, subject in enumerate(available_homework):
 				__text += f'{str(num + 1)}) ' + subject[0].capitalize() + ': ' + subject[1] + '\n'
@@ -191,7 +203,7 @@ async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 		start_date = week_definition(date_count, debug=True)
 		for day in range(6):
 			current_day = (start_date + timedelta(days=day)).strftime('%d.%m.%Y')
-			available_homework = db.is_available_homework_by_date(date=current_day, data=True)
+			available_homework = HDB.is_available_homework_by_date(date=current_day, data=True)
 			__text = ''
 
 			try:
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index ddbd241..4e23087 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -11,19 +11,40 @@ def safe(func):
         def inside(*args, **kwargs):
             with sqlite3.connect(Connections.database) as connection:
                 result = func(*args, connection=(connection, connection.cursor()), **kwargs)
-                return result
-
+            return result
         return inside
 
 
 class Database(object):
 
+    class UsersDB(object):
+        @Connections.safe
+        def init(self, connection: tuple):
+            connection, cursor = connection
+            cursor.execute('''create table if not exists Users (
+            id          INTEGER primary key,
+            chat_id     TEXT not null,
+            user_group  TEXT not null 
+            )''')
+            connection.commit()
+
+        @Connections.safe
+        def add_user(self, connection: tuple, chat_id: str, user_group: str):
+            connection, cursor = connection
+            cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''', (chat_id, user_group.upper()))
+
+        @Connections.safe
+        def get_user_group(self, connection: tuple, chat_id: str) -> str:
+            connection, cursor = connection
+            cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
+            return cursor
+
     @Connections.safe
     def init(self, connection: tuple, name: str = 'Homework') -> None:
         connection, cursor = connection
         cursor.execute(
             f'create table if not exists {name}('
-            f'id     INTEGER primary key,'
+            f'id         INTEGER primary key,'
             f'subject_id int  not null,'
             f'date       text not null,'
             f'text       TEXT not null)')

From a8307af930775d0f885d572e1ae254691d24fb1e Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sat, 12 Mar 2022 16:40:53 +0300
Subject: [PATCH 03/15] Groups update + HOTFIX v 1.6 #13

---
 Course_1/Telegram_Bot/Buttons.py |  2 +-
 Course_1/Telegram_Bot/bot.py     | 46 +++++++++++++++++++++--------
 Course_1/Telegram_Bot/db.py      | 50 ++++++++++++++++++++------------
 3 files changed, 67 insertions(+), 31 deletions(-)

diff --git a/Course_1/Telegram_Bot/Buttons.py b/Course_1/Telegram_Bot/Buttons.py
index 15f7f54..aee98c8 100644
--- a/Course_1/Telegram_Bot/Buttons.py
+++ b/Course_1/Telegram_Bot/Buttons.py
@@ -15,7 +15,7 @@
 Inline_Manage = InlineKeyboardMarkup(inline_keyboard=True)
 Inline_Edit = InlineKeyboardButton(text='Редактировать ДЗ', callback_data='Inline_Edit')
 Inline_Add = InlineKeyboardButton(text='Добавить ДЗ', callback_data='Inline_Add')
-Inline_Manage.add(Inline_Edit).add(Inline_Add)
+Inline_Manage.add(Inline_Add).add(Inline_Edit)
 
 
 Inline_Date.add(Inline_Date_Up).add(Inline_Date_Week).add(Inline_Date_Bm).add(Inline_Date_Bt).add(Inline_Date_Bwd)\
diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index 0a172a6..dcc4a37 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -38,9 +38,13 @@ class SelfState(StatesGroup):
 }
 
 
+def get_user_group(message: types.Message):
+	return UDB.get_user_group(chat_id=message.chat.id)[0][0]
+
+
 @dp.message_handler(commands=['start'], state="*")
 async def process_start_command(message: types.Message):
-	await message.answer("Привет! Для получения задания - введи номер своей группы.\n\n Например: ПИ21-7")
+	await message.answer("Привет! Для получения задания, скажи из какой ты группы!\n\nНапример: ПИ21-7")
 	await SelfState.Group_state.set()
 
 
@@ -76,7 +80,7 @@ async def add_homework_state(call: types.CallbackQuery):
 	await bot.edit_message_text(
 		chat_id=call.message.chat.id,
 		message_id=call.message.message_id,
-		text=f"Вводите домашнее задание в формате:\n*Название предмета  Дата  Задание*",
+		text=f"*Введите домашнее задание:\n\nПример:* `Алгебра 15.03.2022 Подготовиться к кр`",
 		parse_mode="markdown",
 	)
 
@@ -95,8 +99,10 @@ async def add_homework(message: types.Message, state: FSMContext):
 		text='*{}*'.format(
 			HDB.add_homework(
 				subject_name=Subject,
-				date=Date, text=Exercise,
-				username=message.from_user.username)),
+				date=Date,
+				text=Exercise,
+				username=message.from_user.username,
+				group=get_user_group(message))),
 		parse_mode='markdown')
 	try:
 		await bot.delete_message(message.chat.id, message_id=message.message_id - 1)
@@ -110,7 +116,7 @@ async def edit_init(call: types.CallbackQuery):
 	await bot.edit_message_text(
 		chat_id=call.message.chat.id,
 		message_id=call.message.message_id,
-		text=f"*Введите предмет и дату для редактирования в формате:\nНазвание предмета  Дата(Д.М.Г)*",
+		text=f"*Введите предмет и дату для редактирования:\n\nПример:* `Алгебра 15.03.2022`",
 		parse_mode="markdown",
 	)
 
@@ -123,19 +129,19 @@ async def edit_homework(message: types.Message, state: FSMContext):
 		await state.finish()
 		return 0
 	Subject, Date = text[0], text[1]
-	if HDB.is_exists(date=Date, subject_name=Subject):
+	if HDB.is_exists(date=Date, subject_name=Subject, group=get_user_group(message)):
 		print(message.from_user.username, 'отредактировал:\n', text)
 		await bot.edit_message_text(
 			chat_id=message.chat.id,
 			message_id=message.message_id - 1,
-			text=f"Введите данные для изменения в формате:\n*Название Предмета  Дата  Задание*",
+			text=f"*Введите данные для изменения:\n\nПример:* `Алгебра 15.03.2022 Подготовиться к кр`",
 			parse_mode="markdown",
 		)
 		await bot.delete_message(
 			chat_id=message.chat.id,
 			message_id=message.message_id
 		)
-		HDB.delete_homework(subject_name=Subject, date=Date)
+		HDB.delete_homework(subject_name=Subject, date=Date, group=get_user_group(message))
 		await state.finish()
 		await SelfState.Add_state.set()
 	else:
@@ -161,9 +167,22 @@ async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 		date_to_db = [
 			(start_date + timedelta(days=days[day])).strftime('%d.%m.%y'),
 			(start_date + timedelta(days=days[day])).strftime('%d.%m.%Y')]
-		if HDB.is_available_homework_by_date(date=date_to_db[0]) or HDB.is_available_homework_by_date(date=date_to_db[1]):
-			date_to_db = date_to_db[0] if HDB.is_available_homework_by_date(date=date_to_db[0]) else date_to_db[1]
-			available_homework = HDB.is_available_homework_by_date(date=date_to_db, data=True)
+
+		if HDB.is_available_homework_by_date(
+				date=date_to_db[0],
+				group=get_user_group(query.message)) or HDB.is_available_homework_by_date(
+			date=date_to_db[1],
+			group=get_user_group(query.message)):
+
+			date_to_db = date_to_db[0] if HDB.is_available_homework_by_date(
+				date=date_to_db[0],
+				group=get_user_group(query.message)) else date_to_db[1]
+
+			available_homework = HDB.is_available_homework_by_date(
+				date=date_to_db,
+				data=True,
+				group=get_user_group(query.message))
+
 			__text = str()
 			for num, subject in enumerate(available_homework):
 				__text += f'{str(num + 1)}) ' + subject[0].capitalize() + ': ' + subject[1] + '\n'
@@ -203,7 +222,10 @@ async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 		start_date = week_definition(date_count, debug=True)
 		for day in range(6):
 			current_day = (start_date + timedelta(days=day)).strftime('%d.%m.%Y')
-			available_homework = HDB.is_available_homework_by_date(date=current_day, data=True)
+			available_homework = HDB.is_available_homework_by_date(
+				date=current_day,
+				group=get_user_group(call.message),
+				data=True)
 			__text = ''
 
 			try:
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index 4e23087..cc5d4f4 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -31,12 +31,19 @@ def init(self, connection: tuple):
         @Connections.safe
         def add_user(self, connection: tuple, chat_id: str, user_group: str):
             connection, cursor = connection
-            cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''', (chat_id, user_group.upper()))
+            try:
+                cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''',
+                               (chat_id, user_group.upper()))
+            except sqlite3.IntegrityError:
+                cursor.execute('''UPDATE Users SET user_group = ? WHERE chat_id = ?;''', (user_group, chat_id))
+            finally:
+                connection.commit()
 
         @Connections.safe
         def get_user_group(self, connection: tuple, chat_id: str) -> str:
             connection, cursor = connection
             cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
+            connection.commit()
             return cursor
 
     @Connections.safe
@@ -47,27 +54,33 @@ def init(self, connection: tuple, name: str = 'Homework') -> None:
             f'id         INTEGER primary key,'
             f'subject_id int  not null,'
             f'date       text not null,'
-            f'text       TEXT not null)')
+            f'text       text not null'
+            f'"Group"    text not null,'
+            f'Author     text not null)'
+        )
 
         connection.commit()
 
     @Connections.safe
-    def add_homework(self, connection: tuple, subject_name: str, text: str, date: str, username: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date)
+    def add_homework(self, connection: tuple, subject_name: str,
+                     text: str, date: str, username: str, group: str) -> str:
+        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
         subject_name = subject_name.lower()
         if is_added:
             return 'Запись уже присутствует'
         connection, cursor = connection
         # Записываем
-        cursor.execute('''INSERT INTO Homework (subject_id, date, text, Author) VALUES (?, ?, ?, ?)''',
-                       (subject_name, date, text, username))
+        cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
+                       (subject_name, date, text, group, username))
         connection.commit()
         return 'Домашнее задание добавлено'
 
     @Connections.safe
-    def is_available_homework_by_date(self, connection: tuple, date: str, data=False):
+    def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
         connection, cursor = connection
-        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ?''', (date,)).fetchall()
+        print(group)
+        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
+                                (date, group)).fetchall()
         connection.commit()
         if data:
             return cursor
@@ -77,42 +90,43 @@ def is_available_homework_by_date(self, connection: tuple, date: str, data=False
         return False
 
     @Connections.safe
-    def is_exists(self, connection: tuple, subject_name: str, date: str):
+    def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
         connection, cursor = connection
         subject_name = subject_name.lower()
         cursor = cursor.execute(
-            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ?''',
-            (subject_name, date)).fetchall()
+            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
+            (subject_name, date, group)).fetchall()
         connection.commit()
         if cursor:
             return True
         return False
 
     @Connections.safe
-    def receive_homework(self, connection: tuple, subject_name: str, date: str) -> str or List[Tuple[str]]:
+    def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
         subject_name = subject_name.lower()
         connection, cursor = connection
         answer = cursor.execute(
-            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? ''',
-            (subject_name, date)).fetchall()
+            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
+            (subject_name, date, group)).fetchall()
         connection.commit()
         if not answer:
             return answer
         return answer[0][0]
 
     @Connections.safe
-    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str):
+    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
         connection, cursor = connection
         subject_name = subject_name.lower()
         cursor.execute(
-            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ?;''', (text, subject_name, date)
+            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
+            (text, subject_name, date, group)
         )
         connection.commit()
 
     @Connections.safe
-    def delete_homework(self, connection: tuple, subject_name: str, date: str) -> None:
+    def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
         connection, cursor = connection
         subject_name = subject_name.lower()
         cursor.execute('''
-        DELETE FROM Homework WHERE subject_id = ? and date = ?;''', (subject_name, date))
+        DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
         connection.commit()

From d5232c8ba35c21d909536c4a62c4df800d349e68 Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sat, 12 Mar 2022 18:56:01 +0300
Subject: [PATCH 04/15] RAW INLINES v 1.61 #13

---
 Course_1/Telegram_Bot/Buttons.py  | 14 +++++++-
 Course_1/Telegram_Bot/Schedule.py | 46 +++++++++++++++++++++++++
 Course_1/Telegram_Bot/bot.py      | 57 +++++++++++++++++++++++++------
 Course_1/Telegram_Bot/db.py       |  1 -
 4 files changed, 105 insertions(+), 13 deletions(-)
 create mode 100644 Course_1/Telegram_Bot/Schedule.py

diff --git a/Course_1/Telegram_Bot/Buttons.py b/Course_1/Telegram_Bot/Buttons.py
index aee98c8..fb699e9 100644
--- a/Course_1/Telegram_Bot/Buttons.py
+++ b/Course_1/Telegram_Bot/Buttons.py
@@ -1,4 +1,13 @@
 from aiogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
+import transliterate as tr
+
+
+def create_subjects_keyboard(schedule: list or set):
+    buttons_list = []
+    for item in schedule:
+        buttons_list.append([InlineKeyboardButton(text=item, callback_data=tr.translit(item, 'ru', reversed=True))])
+    keyboard_inline_buttons = InlineKeyboardMarkup(inline_keyboard=buttons_list)
+    return keyboard_inline_buttons
 
 
 answer_start = ReplyKeyboardMarkup(resize_keyboard=True).add("Получить задание!").add('Управление заданиями')
@@ -17,7 +26,10 @@
 Inline_Add = InlineKeyboardButton(text='Добавить ДЗ', callback_data='Inline_Add')
 Inline_Manage.add(Inline_Add).add(Inline_Edit)
 
-
+Inline_Date_ADD = InlineKeyboardMarkup()
+Inline_Date_ADD.add(Inline_Date_Up).add(Inline_Date_Bm).add(Inline_Date_Bt).add(Inline_Date_Bwd)\
+    .add(Inline_Date_Bth).add(Inline_Date_Bf)\
+    .add(Inline_Date_Sn).add(Inline_Date_Down)
 Inline_Date.add(Inline_Date_Up).add(Inline_Date_Week).add(Inline_Date_Bm).add(Inline_Date_Bt).add(Inline_Date_Bwd)\
     .add(Inline_Date_Bth).add(Inline_Date_Bf)\
     .add(Inline_Date_Sn).add(Inline_Date_Down)
diff --git a/Course_1/Telegram_Bot/Schedule.py b/Course_1/Telegram_Bot/Schedule.py
new file mode 100644
index 0000000..7444826
--- /dev/null
+++ b/Course_1/Telegram_Bot/Schedule.py
@@ -0,0 +1,46 @@
+from datetime import date, datetime, timedelta
+from typing import List
+
+import requests
+import urllib3
+
+urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+
+
+class Schedule(object):
+    GROUP_SCHEDULE = r'https://ruz.fa.ru/api/schedule/group/{}?start={}&finish={}&lng=1'
+
+    @staticmethod
+    def __current_datetime() -> datetime:
+        return datetime.now()
+
+    @staticmethod
+    def __week_delta() -> timedelta:
+        return timedelta(days=6)
+
+    @staticmethod
+    def __current_week() -> str:
+        return Schedule.__current_date(), (Schedule.__current_datetime() + Schedule.__week_delta()).strftime("%Y.%m.%d")
+
+    @staticmethod
+    def __current_date() -> str:
+        return datetime.now().strftime("%Y.%m.%d")
+
+    @staticmethod
+    def __group_id(group: str = 'ПИ21-7'):
+        form = r'https://ruz.fa.ru/api/search?term={}&type=group'
+        request = requests.get(form.format(group), verify=False)
+        if request.status_code == 200:
+            return request.json()[0]["id"]
+
+    @classmethod
+    def get_group_schedule(cls, group: str, start: date = None, end: date = None) -> List[dict]:
+        if start is None:
+            start, end = cls.__current_week()
+        group = cls.__group_id(group)
+        request = requests.get(cls.GROUP_SCHEDULE.format(group, start, end), verify=False)
+        if request.status_code == 200:
+            return request.json()
+        return 'NO RESPONCE'
+
+
diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index dcc4a37..8c1ac33 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -1,7 +1,7 @@
-
+import datetime
 from datetime import timedelta
-
-
+from Schedule import Schedule
+import transliterate as tr
 import aiogram.utils.exceptions
 from aiogram import Bot, types
 from aiogram.dispatcher import Dispatcher
@@ -42,6 +42,36 @@ def get_user_group(message: types.Message):
 	return UDB.get_user_group(chat_id=message.chat.id)[0][0]
 
 
+def get_group_schedule(group: str, start: datetime.date) -> set:
+	end = (start + timedelta(weeks=2)).strftime("%Y.%m.%d")
+	start = start.strftime("%Y.%m.%d")
+	SCHEDULE = Schedule.get_group_schedule(group=group, start=start, end=end)
+	lessons = set()
+	for i in SCHEDULE:
+		lessons.add(
+			i['discipline'] + ' ' + i['lecturer_title'].split()[0]
+			if i['discipline'] == 'Иностранный язык'
+			else i['discipline'])
+	return lessons
+
+
+@dp.callback_query_handler(lambda query: 'Inline' not in query.data, state='*')
+async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
+	try:
+		async with state.proxy() as data:
+			data['subject'] = tr.translit(query.data, language_code='ru')
+			date_count = data['date_count']
+		start_date, end_date = week_definition(date_count)
+		await bot.edit_message_text(
+			chat_id=query.message.chat.id,
+			message_id=query.message.message_id,
+			text=f'*На какой день задание?*\n{start_date} - {end_date}',
+			reply_markup=Buttons.Inline_Date_ADD,
+			parse_mode='markdown')
+	except KeyError as e:
+		print(e)
+
+
 @dp.message_handler(commands=['start'], state="*")
 async def process_start_command(message: types.Message):
 	await message.answer("Привет! Для получения задания, скажи из какой ты группы!\n\nНапример: ПИ21-7")
@@ -60,6 +90,8 @@ async def group_state_command(message: types.Message, state: FSMContext):
 @dp.message_handler(lambda message: message.text == 'Управление заданиями', state="*")
 async def process_add_command(message: types.Message, state: FSMContext):
 	await state.finish()
+	async with state.proxy() as data:
+		data['date_count'] = 0
 	print(message.from_user.username, 'управляет заданиями')
 	if message.from_user.username in green_list:
 		await message.answer(
@@ -75,13 +107,16 @@ async def process_add_command(message: types.Message, state: FSMContext):
 
 
 @dp.callback_query_handler(text='Inline_Add')
-async def add_homework_state(call: types.CallbackQuery):
+async def add_homework_state(call: types.CallbackQuery, state: FSMContext):
+	start_date = datetime.datetime.now()
 	await SelfState.Add_state.set()
+	print(Buttons.create_subjects_keyboard(get_group_schedule(get_user_group(call.message), start=start_date)))
 	await bot.edit_message_text(
 		chat_id=call.message.chat.id,
 		message_id=call.message.message_id,
-		text=f"*Введите домашнее задание:\n\nПример:* `Алгебра 15.03.2022 Подготовиться к кр`",
+		text=f"*Выберите предмет*",
 		parse_mode="markdown",
+		reply_markup=Buttons.create_subjects_keyboard(get_group_schedule(get_user_group(call.message), start=start_date))
 	)
 
 
@@ -149,7 +184,7 @@ async def edit_homework(message: types.Message, state: FSMContext):
 		await state.finish()
 
 
-@dp.callback_query_handler(lambda query: query.data.split('_')[2][0] == 'B')
+@dp.callback_query_handler(lambda query: query.data.split('_')[1][0] == 'B')
 async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 	day = query.data.split("_")[2]
 	try:
@@ -210,11 +245,11 @@ async def process_date(message: types.Message, state: FSMContext):
 	async with state.proxy() as data:
 		data['date_count'] = 0
 	await message.answer(
-		f"*Выбираем дату \n{week_definition(0)[0]} - {week_definition(0)[1]}*",
+		f"*Выбираем день недели\n{week_definition(0)[0]} - {week_definition(0)[1]}*",
 		parse_mode="markdown", reply_markup=Buttons.Inline_Date)
 
 
-@dp.callback_query_handler(text='Inline_Date_Week')
+@dp.callback_query_handler(text='Inline_Date_Week', state='*')
 async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 	try:
 		async with state.proxy() as data:
@@ -247,7 +282,7 @@ async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 		await process_start_command(call.message)
 
 
-@dp.callback_query_handler(text="Inline_Date_Down")
+@dp.callback_query_handler(text="Inline_Date_Down", state='*')
 async def callback_down(call: types.CallbackQuery, state: FSMContext):
 	try:
 		async with state.proxy() as data:
@@ -256,7 +291,7 @@ async def callback_down(call: types.CallbackQuery, state: FSMContext):
 		await bot.edit_message_text(
 			chat_id=call.message.chat.id,
 			message_id=call.message.message_id,
-			text=f"*Выбираем день недели \n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
+			text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
 			parse_mode="markdown",
 			reply_markup=Buttons.Inline_Date)
 	except KeyError:
@@ -272,7 +307,7 @@ async def callback_up(call: types.CallbackQuery, state: FSMContext):
 		await bot.edit_message_text(
 			chat_id=call.message.chat.id,
 			message_id=call.message.message_id,
-			text=f"*Выбираем дату \n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
+			text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
 			parse_mode="markdown",
 			reply_markup=Buttons.Inline_Date)
 	except KeyError:
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index cc5d4f4..72f1ac6 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -78,7 +78,6 @@ def add_homework(self, connection: tuple, subject_name: str,
     @Connections.safe
     def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
         connection, cursor = connection
-        print(group)
         cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
                                 (date, group)).fetchall()
         connection.commit()

From c8c3be5ea767713cd30d40b85e1719b2f9599a3f Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sat, 12 Mar 2022 20:17:01 +0300
Subject: [PATCH 05/15] RAW INLINES v 1.62 #13

---
 Course_1/Telegram_Bot/Tests/tests.py |  4 ++--
 Course_1/Telegram_Bot/bot.py         |  1 -
 Course_1/Telegram_Bot/db.py          | 14 +++++++-------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/Course_1/Telegram_Bot/Tests/tests.py b/Course_1/Telegram_Bot/Tests/tests.py
index cd5a87d..c59b594 100644
--- a/Course_1/Telegram_Bot/Tests/tests.py
+++ b/Course_1/Telegram_Bot/Tests/tests.py
@@ -4,7 +4,7 @@
 
 
 class DatabaseTests(unittest.TestCase):
-    Test_DB = Database()
+    Test_DB = Database.UsersDB()
 
     def test_init(self):
         """
@@ -12,7 +12,7 @@ def test_init(self):
         """
         Database_NAME = 'TEST_DATABASE'
         Connections.database = f'{Database_NAME}.db'
-        self.Test_DB.init(name=Database_NAME)
+        self.Test_DB.init()
         self.assertTrue(os.path.exists(Connections.database), 'База данных не создалась или создалась некорректно')
 
 
diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index 8c1ac33..8362e09 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -27,7 +27,6 @@ class SelfState(StatesGroup):
 dp = Dispatcher(bot, storage=storage)
 HDB = Database()
 UDB = Database.UsersDB()
-
 days_of_week = {
 	1: 'Понедельник',
 	2: 'Вторник',
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index 72f1ac6..346105b 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -23,8 +23,8 @@ def init(self, connection: tuple):
             connection, cursor = connection
             cursor.execute('''create table if not exists Users (
             id          INTEGER primary key,
-            chat_id     TEXT not null,
-            user_group  TEXT not null 
+            chat_id     TEXT,
+            user_group  TEXT
             )''')
             connection.commit()
 
@@ -52,11 +52,11 @@ def init(self, connection: tuple, name: str = 'Homework') -> None:
         cursor.execute(
             f'create table if not exists {name}('
             f'id         INTEGER primary key,'
-            f'subject_id int  not null,'
-            f'date       text not null,'
-            f'text       text not null'
-            f'"Group"    text not null,'
-            f'Author     text not null)'
+            f'subject_id int,'
+            f'date       text,'
+            f'text       text,'
+            f'"Group"    text,'
+            f'Author     text)'
         )
 
         connection.commit()

From 4ef56c59e2627736fe955aa7cac2e41c5402fd9d Mon Sep 17 00:00:00 2001
From: GinKey <monotank23@gmail.com>
Date: Sat, 12 Mar 2022 20:33:27 +0300
Subject: [PATCH 06/15] potnaya banya #13

---
 Course_1/Telegram_Bot/bot.py | 27 ++++++++++++++++++---------
 Course_1/Telegram_Bot/db.py  |  6 +++---
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index 8c1ac33..89600df 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -37,6 +37,9 @@ class SelfState(StatesGroup):
 	6: 'Суббота'
 }
 
+HDB.init()
+UDB.init()
+HDB.add_homework(subject_name = "алгебра", text = "кр", date = "12.03.2022", username="monotank", group = "ПИ21-7")
 
 def get_user_group(message: types.Message):
 	return UDB.get_user_group(chat_id=message.chat.id)[0][0]
@@ -55,12 +58,13 @@ def get_group_schedule(group: str, start: datetime.date) -> set:
 	return lessons
 
 
-@dp.callback_query_handler(lambda query: 'Inline' not in query.data, state='*')
+@dp.callback_query_handler(lambda query: 'Inline' not in query.data, state=SelfState.Add_state)
 async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
 	try:
 		async with state.proxy() as data:
 			data['subject'] = tr.translit(query.data, language_code='ru')
 			date_count = data['date_count']
+			data["state"] = True
 		start_date, end_date = week_definition(date_count)
 		await bot.edit_message_text(
 			chat_id=query.message.chat.id,
@@ -68,6 +72,7 @@ async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
 			text=f'*На какой день задание?*\n{start_date} - {end_date}',
 			reply_markup=Buttons.Inline_Date_ADD,
 			parse_mode='markdown')
+		await SelfState.Add_state.set()
 	except KeyError as e:
 		print(e)
 
@@ -244,6 +249,7 @@ async def process_date(message: types.Message, state: FSMContext):
 	await state.finish()
 	async with state.proxy() as data:
 		data['date_count'] = 0
+		data["state"] = False
 	await message.answer(
 		f"*Выбираем день недели\n{week_definition(0)[0]} - {week_definition(0)[1]}*",
 		parse_mode="markdown", reply_markup=Buttons.Inline_Date)
@@ -288,28 +294,31 @@ async def callback_down(call: types.CallbackQuery, state: FSMContext):
 		async with state.proxy() as data:
 			data['date_count'] += 1
 			date_count = data['date_count']
-		await bot.edit_message_text(
-			chat_id=call.message.chat.id,
-			message_id=call.message.message_id,
-			text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
-			parse_mode="markdown",
-			reply_markup=Buttons.Inline_Date)
+			button_state = data["state"]
+			await bot.edit_message_text(
+				chat_id=call.message.chat.id,
+				message_id=call.message.message_id,
+				text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
+				parse_mode="markdown",
+				reply_markup=Buttons.Inline_Date_ADD if button_state else Buttons.Inline_Date)
+
 	except KeyError:
 		pass
 
 
-@dp.callback_query_handler(text="Inline_Date_Up")
+@dp.callback_query_handler(text="Inline_Date_Up", state='*')
 async def callback_up(call: types.CallbackQuery, state: FSMContext):
 	try:
 		async with state.proxy() as data:
 			data['date_count'] -= 1
 			date_count = data['date_count']
+			button_state = data["state"]
 		await bot.edit_message_text(
 			chat_id=call.message.chat.id,
 			message_id=call.message.message_id,
 			text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
 			parse_mode="markdown",
-			reply_markup=Buttons.Inline_Date)
+			reply_markup=Buttons.Inline_Date_ADD if button_state else Buttons.Inline_Date)
 	except KeyError:
 		pass
 
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index 72f1ac6..9fe1e8d 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -54,8 +54,8 @@ def init(self, connection: tuple, name: str = 'Homework') -> None:
             f'id         INTEGER primary key,'
             f'subject_id int  not null,'
             f'date       text not null,'
-            f'text       text not null'
-            f'"Group"    text not null,'
+            f'text       text not null,'
+            f'"Group"      text not null,'
             f'Author     text not null)'
         )
 
@@ -128,4 +128,4 @@ def delete_homework(self, connection: tuple, subject_name: str, date: str, group
         subject_name = subject_name.lower()
         cursor.execute('''
         DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
-        connection.commit()
+        connection.commit()
\ No newline at end of file

From cd4f3bcdf2234546a079a33cf92df01670774044 Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sun, 13 Mar 2022 01:07:32 +0300
Subject: [PATCH 07/15] BIG UPDATE v 1.8 #13

---
 Course_1/Telegram_Bot/Buttons.py |  8 +--
 Course_1/Telegram_Bot/bot.py     | 83 ++++++++++++++++++++++++--------
 Course_1/Telegram_Bot/db.py      |  5 --
 3 files changed, 69 insertions(+), 27 deletions(-)

diff --git a/Course_1/Telegram_Bot/Buttons.py b/Course_1/Telegram_Bot/Buttons.py
index fb699e9..1ec9fa8 100644
--- a/Course_1/Telegram_Bot/Buttons.py
+++ b/Course_1/Telegram_Bot/Buttons.py
@@ -1,11 +1,13 @@
 from aiogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
-import transliterate as tr
+from transliterate import translit
 
 
 def create_subjects_keyboard(schedule: list or set):
     buttons_list = []
     for item in schedule:
-        buttons_list.append([InlineKeyboardButton(text=item, callback_data=tr.translit(item, 'ru', reversed=True))])
+        item: str
+        buttons_list.append([InlineKeyboardButton(text=item, callback_data=translit(
+            item, language_code='ru', reversed=True))])
     keyboard_inline_buttons = InlineKeyboardMarkup(inline_keyboard=buttons_list)
     return keyboard_inline_buttons
 
@@ -13,7 +15,7 @@ def create_subjects_keyboard(schedule: list or set):
 answer_start = ReplyKeyboardMarkup(resize_keyboard=True).add("Получить задание!").add('Управление заданиями')
 Inline_Date = InlineKeyboardMarkup(inline_keyboard=True, row_width=3)
 Inline_Date_Week = InlineKeyboardButton(text='Вся неделя 🥶', callback_data='Inline_Date_Week')
-Inline_Date_Bm = InlineKeyboardButton(text='понедельник 💀', callback_data='Inline_Date_Bm')
+Inline_Date_Bm = InlineKeyboardButton(text='Понедельник 💀', callback_data='Inline_Date_Bm')
 Inline_Date_Bt = InlineKeyboardButton(text='Вторник 🤯', callback_data='Inline_Date_Bt')
 Inline_Date_Bwd = InlineKeyboardButton(text='Среда 😒', callback_data='Inline_Date_Bwd')
 Inline_Date_Bth = InlineKeyboardButton(text='Четверг 🤨', callback_data='Inline_Date_Bth')
diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index d745235..23d8b95 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -1,5 +1,6 @@
 import datetime
 from datetime import timedelta
+
 from Schedule import Schedule
 import transliterate as tr
 import aiogram.utils.exceptions
@@ -36,42 +37,55 @@ class SelfState(StatesGroup):
 	6: 'Суббота'
 }
 
-HDB.init()
-UDB.init()
-HDB.add_homework(subject_name = "алгебра", text = "кр", date = "12.03.2022", username="monotank", group = "ПИ21-7")
 
 def get_user_group(message: types.Message):
 	return UDB.get_user_group(chat_id=message.chat.id)[0][0]
 
 
-def get_group_schedule(group: str, start: datetime.date) -> set:
+def get_group_schedule(group: str, start: datetime.date) -> list:
 	end = (start + timedelta(weeks=2)).strftime("%Y.%m.%d")
 	start = start.strftime("%Y.%m.%d")
 	SCHEDULE = Schedule.get_group_schedule(group=group, start=start, end=end)
 	lessons = set()
 	for i in SCHEDULE:
+		if i['discipline'] == 'Элективные дисциплины по физической культуре и спорту':
+			continue
 		lessons.add(
 			i['discipline'] + ' ' + i['lecturer_title'].split()[0]
 			if i['discipline'] == 'Иностранный язык'
 			else i['discipline'])
-	return lessons
+
+	return list(lessons)
 
 
 @dp.callback_query_handler(lambda query: 'Inline' not in query.data, state=SelfState.Add_state)
 async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
 	try:
 		async with state.proxy() as data:
-			data['subject'] = tr.translit(query.data, language_code='ru')
+			data['subject'] = query.conf
 			date_count = data['date_count']
 			data["state"] = True
+
+		schedule = get_group_schedule(group=get_user_group(query.message), start=week_definition(date_count, debug=True))
+		transliterated_schedule = list(map(
+			lambda x: tr.translit(x, language_code='ru', reversed=True), schedule))
+		subject = None
+		for pos, let in enumerate(transliterated_schedule):
+			if query.data == let:
+				subject = schedule[pos]
+		if subject is None:
+			async with state.proxy() as data:
+				subject = data['subject']
+
+		async with state.proxy() as data:
+			data['subject'] = subject
 		start_date, end_date = week_definition(date_count)
 		await bot.edit_message_text(
 			chat_id=query.message.chat.id,
 			message_id=query.message.message_id,
-			text=f'*На какой день задание?*\n{start_date} - {end_date}',
+			text=f'*На какой день задание?\n📅 {start_date} - {end_date} 📅*',
 			reply_markup=Buttons.Inline_Date_ADD,
 			parse_mode='markdown')
-		await SelfState.Add_state.set()
 	except KeyError as e:
 		print(e)
 
@@ -111,10 +125,9 @@ async def process_add_command(message: types.Message, state: FSMContext):
 
 
 @dp.callback_query_handler(text='Inline_Add')
-async def add_homework_state(call: types.CallbackQuery, state: FSMContext):
+async def add_homework_state(call: types.CallbackQuery):
 	start_date = datetime.datetime.now()
 	await SelfState.Add_state.set()
-	print(Buttons.create_subjects_keyboard(get_group_schedule(get_user_group(call.message), start=start_date)))
 	await bot.edit_message_text(
 		chat_id=call.message.chat.id,
 		message_id=call.message.message_id,
@@ -126,14 +139,19 @@ async def add_homework_state(call: types.CallbackQuery, state: FSMContext):
 
 @dp.message_handler(state=SelfState.Add_state)
 async def add_homework(message: types.Message, state: FSMContext):
-	await state.finish()
-	text = message.text.split()
+	text = message.text
 	print(message.from_user.username, 'добавил:\n', text)
-	if len(text) < 3:
-		await message.answer(text='*Что?*🤨', parse_mode='markdown')
+	try:
+		async with state.proxy() as data:
+			Date = data['date']
+			Subject = data['subject']
+			data['state'] = False
+	except KeyError:
+		await message.answer(text='Ну ладно 🥺', parse_mode='markdown')
 		await state.finish()
 		return
-	Subject, Date, Exercise = text[0], text[1], ' '.join(text[2:])
+	await state.finish()
+	Exercise = text
 	await message.answer(
 		text='*{}*'.format(
 			HDB.add_homework(
@@ -188,7 +206,34 @@ async def edit_homework(message: types.Message, state: FSMContext):
 		await state.finish()
 
 
-@dp.callback_query_handler(lambda query: query.data.split('_')[1][0] == 'B')
+@dp.callback_query_handler(lambda query: query.data.split('_')[2][0] == 'B', state=SelfState.Add_state)
+async def add_homework_date(query: types.CallbackQuery, state: FSMContext):
+	async with state.proxy() as data:
+		current_state = data['state']
+		date_count = data['date_count']
+	if current_state:
+		day = query.data.split("_")[2]
+		days = {
+			'Bm': 0,
+			'Bt': 1,
+			'Bwd': 2,
+			'Bth': 3,
+			'Bf': 4,
+			'BSn': 5
+		}
+		start_date = week_definition(date_count, debug=True)
+		await bot.edit_message_text(
+			text='*Введите домашнее задание*',
+			chat_id=query.message.chat.id,
+			message_id=query.message.message_id,
+			parse_mode='markdown'
+		)
+		async with state.proxy() as data:
+			data['date'] = (start_date + timedelta(days=days[day])).strftime('%d.%m.%Y')
+		await SelfState.Add_state.set()
+
+
+@dp.callback_query_handler(lambda query: query.data.split('_')[2][0] == 'B')
 async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 	day = query.data.split("_")[2]
 	try:
@@ -250,7 +295,7 @@ async def process_date(message: types.Message, state: FSMContext):
 		data['date_count'] = 0
 		data["state"] = False
 	await message.answer(
-		f"*Выбираем день недели\n{week_definition(0)[0]} - {week_definition(0)[1]}*",
+		f"*Выбираем день недели\n📅 {week_definition(0)[0]} - {week_definition(0)[1]} 📅*",
 		parse_mode="markdown", reply_markup=Buttons.Inline_Date)
 
 
@@ -297,7 +342,7 @@ async def callback_down(call: types.CallbackQuery, state: FSMContext):
 			await bot.edit_message_text(
 				chat_id=call.message.chat.id,
 				message_id=call.message.message_id,
-				text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
+				text=f"*{'Выбираем день недели' if not button_state else 'На какой день задание?'}\n📅 {week_definition(date_count)[0]} - {week_definition(date_count)[1]} 📅*",
 				parse_mode="markdown",
 				reply_markup=Buttons.Inline_Date_ADD if button_state else Buttons.Inline_Date)
 
@@ -315,7 +360,7 @@ async def callback_up(call: types.CallbackQuery, state: FSMContext):
 		await bot.edit_message_text(
 			chat_id=call.message.chat.id,
 			message_id=call.message.message_id,
-			text=f"*Выбираем день недели\n{week_definition(date_count)[0]} - {week_definition(date_count)[1]}*",
+			text=f"*{'Выбираем день недели' if not button_state else 'На какой день задание?'}\n📅 {week_definition(date_count)[0]} - {week_definition(date_count)[1]} 📅*",
 			parse_mode="markdown",
 			reply_markup=Buttons.Inline_Date_ADD if button_state else Buttons.Inline_Date)
 	except KeyError:
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index 9fe1e8d..0809345 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -65,7 +65,6 @@ def init(self, connection: tuple, name: str = 'Homework') -> None:
     def add_homework(self, connection: tuple, subject_name: str,
                      text: str, date: str, username: str, group: str) -> str:
         is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        subject_name = subject_name.lower()
         if is_added:
             return 'Запись уже присутствует'
         connection, cursor = connection
@@ -91,7 +90,6 @@ def is_available_homework_by_date(self, connection: tuple, date: str, group: str
     @Connections.safe
     def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
         connection, cursor = connection
-        subject_name = subject_name.lower()
         cursor = cursor.execute(
             '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
             (subject_name, date, group)).fetchall()
@@ -102,7 +100,6 @@ def is_exists(self, connection: tuple, subject_name: str, date: str, group: str)
 
     @Connections.safe
     def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
-        subject_name = subject_name.lower()
         connection, cursor = connection
         answer = cursor.execute(
             '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
@@ -115,7 +112,6 @@ def receive_homework(self, connection: tuple, subject_name: str, date: str, grou
     @Connections.safe
     def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
         connection, cursor = connection
-        subject_name = subject_name.lower()
         cursor.execute(
             '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
             (text, subject_name, date, group)
@@ -125,7 +121,6 @@ def edit_homework(self, connection: tuple, subject_name: str, date: str, text: s
     @Connections.safe
     def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
         connection, cursor = connection
-        subject_name = subject_name.lower()
         cursor.execute('''
         DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
         connection.commit()
\ No newline at end of file

From 3aba409c7d94856ada575dfd11ef781190541282 Mon Sep 17 00:00:00 2001
From: prodbyhidden <denis.zak2003@gmail.com>
Date: Sun, 13 Mar 2022 13:12:54 +0300
Subject: [PATCH 08/15] prodhidden's first commit

---
 hello_world.py | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 hello_world.py

diff --git a/hello_world.py b/hello_world.py
new file mode 100644
index 0000000..0e3fc00
--- /dev/null
+++ b/hello_world.py
@@ -0,0 +1 @@
+print("Hello World!") 

From 989fb108d7aee4639278cada4973b288a192fa8e Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sun, 13 Mar 2022 13:29:17 +0300
Subject: [PATCH 09/15] BAN LIST UPDATE v 1.81 #13

---
 Course_1/Telegram_Bot/bot.py | 10 +++++++---
 Course_1/Telegram_Bot/db.py  |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index 23d8b95..eff255d 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -42,6 +42,11 @@ def get_user_group(message: types.Message):
 	return UDB.get_user_group(chat_id=message.chat.id)[0][0]
 
 
+@dp.message_handler(lambda message: message.from_user.username == 'lexus_20013')
+async def ban_list(message: types.Message):
+	await bot.send_sticker(chat_id=message.chat.id, sticker='CAACAgIAAxkBAAEEIkRiLSC1ulNm9d8Y1IXYO7qlrPnmmQACLQADgzHTFIsV3PfSfsqdIwQ')
+
+
 def get_group_schedule(group: str, start: datetime.date) -> list:
 	end = (start + timedelta(weeks=2)).strftime("%Y.%m.%d")
 	start = start.strftime("%Y.%m.%d")
@@ -266,10 +271,9 @@ async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 				date=date_to_db,
 				data=True,
 				group=get_user_group(query.message))
-
 			__text = str()
 			for num, subject in enumerate(available_homework):
-				__text += f'{str(num + 1)}) ' + subject[0].capitalize() + ': ' + subject[1] + '\n'
+				__text += f'{str(num + 1)}) ' + subject[0] + ': ' + subject[1] + '\n'
 			await query.message.answer(
 				text=f'*📅 {days_of_week[days[day] + 1]} {date_to_db}*\n`{__text}`',
 				parse_mode='markdown'
@@ -320,7 +324,7 @@ async def all_week_homework(call: types.CallbackQuery, state: FSMContext):
 
 			for num, subject in enumerate(available_homework):
 				__text += \
-					f'{str(num + 1)}) ' + subject[0].capitalize() + ': ' + subject[1] + '\n'
+					f'{str(num + 1)}) ' + subject[0] + ': ' + subject[1] + '\n'
 			if not __text:
 				__text = '*Никто не заполнил домашнее задания на этот день* 😭'
 			else:
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index 0809345..196be1b 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -55,7 +55,7 @@ def init(self, connection: tuple, name: str = 'Homework') -> None:
             f'subject_id int  not null,'
             f'date       text not null,'
             f'text       text not null,'
-            f'"Group"      text not null,'
+            f'"Group"    text not null,'
             f'Author     text not null)'
         )
 

From 5a634aea73fdf276e8ac6d6d6574d5f68c212f1a Mon Sep 17 00:00:00 2001
From: Nikolai Pikalov <90862688+Nps-rf@users.noreply.github.com>
Date: Sun, 13 Mar 2022 13:29:49 +0300
Subject: [PATCH 10/15] Delete hello_world.py

---
 hello_world.py | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 hello_world.py

diff --git a/hello_world.py b/hello_world.py
deleted file mode 100644
index 0e3fc00..0000000
--- a/hello_world.py
+++ /dev/null
@@ -1 +0,0 @@
-print("Hello World!") 

From e74ec25d65089fe1232d3e9d223c2e94999ba137 Mon Sep 17 00:00:00 2001
From: Nikolai Pikalov <90862688+Nps-rf@users.noreply.github.com>
Date: Sun, 13 Mar 2022 13:34:36 +0300
Subject: [PATCH 11/15] Delete db_BASE_1182.py

---
 Course_1/Telegram_Bot/db_BASE_1182.py | 131 --------------------------
 1 file changed, 131 deletions(-)
 delete mode 100644 Course_1/Telegram_Bot/db_BASE_1182.py

diff --git a/Course_1/Telegram_Bot/db_BASE_1182.py b/Course_1/Telegram_Bot/db_BASE_1182.py
deleted file mode 100644
index 72f1ac6..0000000
--- a/Course_1/Telegram_Bot/db_BASE_1182.py
+++ /dev/null
@@ -1,131 +0,0 @@
-import sqlite3
-
-from typing import List, Tuple
-
-
-class Connections(object):
-    database = 'Homework.db'
-
-    @staticmethod
-    def safe(func):
-        def inside(*args, **kwargs):
-            with sqlite3.connect(Connections.database) as connection:
-                result = func(*args, connection=(connection, connection.cursor()), **kwargs)
-            return result
-        return inside
-
-
-class Database(object):
-
-    class UsersDB(object):
-        @Connections.safe
-        def init(self, connection: tuple):
-            connection, cursor = connection
-            cursor.execute('''create table if not exists Users (
-            id          INTEGER primary key,
-            chat_id     TEXT not null,
-            user_group  TEXT not null 
-            )''')
-            connection.commit()
-
-        @Connections.safe
-        def add_user(self, connection: tuple, chat_id: str, user_group: str):
-            connection, cursor = connection
-            try:
-                cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''',
-                               (chat_id, user_group.upper()))
-            except sqlite3.IntegrityError:
-                cursor.execute('''UPDATE Users SET user_group = ? WHERE chat_id = ?;''', (user_group, chat_id))
-            finally:
-                connection.commit()
-
-        @Connections.safe
-        def get_user_group(self, connection: tuple, chat_id: str) -> str:
-            connection, cursor = connection
-            cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
-            connection.commit()
-            return cursor
-
-    @Connections.safe
-    def init(self, connection: tuple, name: str = 'Homework') -> None:
-        connection, cursor = connection
-        cursor.execute(
-            f'create table if not exists {name}('
-            f'id         INTEGER primary key,'
-            f'subject_id int  not null,'
-            f'date       text not null,'
-            f'text       text not null'
-            f'"Group"    text not null,'
-            f'Author     text not null)'
-        )
-
-        connection.commit()
-
-    @Connections.safe
-    def add_homework(self, connection: tuple, subject_name: str,
-                     text: str, date: str, username: str, group: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        subject_name = subject_name.lower()
-        if is_added:
-            return 'Запись уже присутствует'
-        connection, cursor = connection
-        # Записываем
-        cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
-                       (subject_name, date, text, group, username))
-        connection.commit()
-        return 'Домашнее задание добавлено'
-
-    @Connections.safe
-    def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
-        connection, cursor = connection
-        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
-                                (date, group)).fetchall()
-        connection.commit()
-        if data:
-            return cursor
-
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor = cursor.execute(
-            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
-        subject_name = subject_name.lower()
-        connection, cursor = connection
-        answer = cursor.execute(
-            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if not answer:
-            return answer
-        return answer[0][0]
-
-    @Connections.safe
-    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute(
-            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
-            (text, subject_name, date, group)
-        )
-        connection.commit()
-
-    @Connections.safe
-    def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute('''
-        DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
-        connection.commit()

From ef8909a65c6c6d21543c5bd1069ee944eb7ff9d5 Mon Sep 17 00:00:00 2001
From: Nikolai Pikalov <90862688+Nps-rf@users.noreply.github.com>
Date: Sun, 13 Mar 2022 13:34:59 +0300
Subject: [PATCH 12/15] Delete .db_BASE_1182.py.swp

---
 Course_1/Telegram_Bot/.db_BASE_1182.py.swp | Bin 16384 -> 0 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 Course_1/Telegram_Bot/.db_BASE_1182.py.swp

diff --git a/Course_1/Telegram_Bot/.db_BASE_1182.py.swp b/Course_1/Telegram_Bot/.db_BASE_1182.py.swp
deleted file mode 100644
index 881f5e26945a1952b9edaf636116af4e4548d2df..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 16384
zcmeHOON<mn7%o5*1=MJ~pe7~6%nTWZS4;@H=spJ6@C-X3NO0(#saYCky2tJwcGtJ4
z2~jjgi5v_OV?w+bk$@6m;o!xCkDh}j9#Io7l1RjOFeZL~clBdlJImvsNmce^rn{>C
zs`~!=tLp!27+$h%a06eFS;mm=WbF5|i-zBuGl%_h6Js@7SoFGE8psZ<%Wc}cC_AvB
zZ*ap<$KubEz{RV37x$Yr%N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KUz!I!@T
z)BzXx0@wy*fa$=m=+AzD`n7}lrjlYnF`yVw3@8Q^1BwB~z<->9;Itkc#9Lji0o-W7
zr@qeH3+ZSF5haSd1hG>YLT6!TTHN|DD_)(#jPjO+q+Ro^MiKwN)rm(bulsI;;*C>^
z9!*AjqsNn^*k0rHN+W$CMZ_W;WElwwLRy@HAzpki3WEgf!QTz87re+|@DRiu@$6|Y
zY@*5M4c`X>NgX#zJEEvN*A%Ob-#f(u#@=L$2P9gZ<#0UG@6`+&_hmbm?80A|$B`QH
z!yFmU^lL>P=VZDjVGYsoM%}i(U7|YBv%GKgRC}E!N}(`DVk!CEhZZ|2I~vdAaf_)=
y3UatxZwzjTEh6^Maal?(_D;{k-ibH6cKN#LuK%mPg7g`Thjv<5RVp)8mH!I~?u8=&


From 090caac1269cb579b783d61cef0c48878b0cb293 Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sun, 13 Mar 2022 13:35:54 +0300
Subject: [PATCH 13/15] BAN LIST UPDATE v 1.81 #13

---
 Course_1/Telegram_Bot/.db.py.swp             | Bin 16384 -> 0 bytes
 Course_1/Telegram_Bot/.db_BASE_1182.py.swp   | Bin 16384 -> 0 bytes
 Course_1/Telegram_Bot/.db_LOCAL_1182.py.swp  | Bin 16384 -> 0 bytes
 Course_1/Telegram_Bot/.db_REMOTE_1182.py.swp | Bin 16384 -> 0 bytes
 Course_1/Telegram_Bot/db.py.orig             | 131 -------------------
 Course_1/Telegram_Bot/db_BASE_1182.py        | 131 -------------------
 Course_1/Telegram_Bot/db_LOCAL_1182.py       | 131 -------------------
 Course_1/Telegram_Bot/db_REMOTE_1182.py      | 131 -------------------
 8 files changed, 524 deletions(-)
 delete mode 100644 Course_1/Telegram_Bot/.db.py.swp
 delete mode 100644 Course_1/Telegram_Bot/.db_BASE_1182.py.swp
 delete mode 100644 Course_1/Telegram_Bot/.db_LOCAL_1182.py.swp
 delete mode 100644 Course_1/Telegram_Bot/.db_REMOTE_1182.py.swp
 delete mode 100644 Course_1/Telegram_Bot/db.py.orig
 delete mode 100644 Course_1/Telegram_Bot/db_BASE_1182.py
 delete mode 100644 Course_1/Telegram_Bot/db_LOCAL_1182.py
 delete mode 100644 Course_1/Telegram_Bot/db_REMOTE_1182.py

diff --git a/Course_1/Telegram_Bot/.db.py.swp b/Course_1/Telegram_Bot/.db.py.swp
deleted file mode 100644
index 90ad8d84ce319ab4cf8f8db01fe571cdcf4dfffb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 16384
zcmeHOON<mn7%mXspn{1PE+xcF4-Uh_i$NC!c90EE*;xb$j=eKAyDc-_V|Nd`8{-Q!
zApz8bk;KHri;siGl>ibI@a6@y=VCNo)c81=XyW6diQnH{{o0w?Sy&F3RAs-+bXV11
zRo`EKRsDa>4zJubu$AANU(JwiW9+w2mJc7FKcD?LkFlmBY<k@*^%n*=7q{<NUg+Pt
zeqifh*W%BRz!e+Ut=M2SZAX+=ttg6`7_s$wX}#sHs0`;D6J0B-48?$AV3rKrGIY=C
zRVzuz(j|BD+ZPSZQl6@=7*Gr-1{4E|0mXn~Krx^gPz?N^7;qbN*|X^IT-oWz<>#C!
zpV!FerSemsk}n_Chhji6pcqgLC<YV*iUGxdVn8vV7*Gr-1{4EVAp?4av4!Z@`{eNB
z{{L~=$KP+oZvlW7-~nF(CxPR@YrqRY1K12)3%q*^V=n>Yz!-1<cnsJFtOqpU-vy8d
zyaJSg0-ynR0DsMA>`&lZ;259-JAglKX6!U@1Xv7Q2mEjoW8VXx15X1F1K-`q*k{1o
zz+1q}z$SnLHvnJVz}P#$Gr$m#1Lgo<U(eVVz(wFgU=ny8*aO@Qd~h9OhX51E0rP;L
zu4U{=U^%c5xQO3MTmVi3gTURuc?3*e1Pov|uomb8mH~@^e-Uu`2lyFy1sDbH2NnaQ
zi}%6+jMN84l1`aSX0WiOu%XDE=I|4u?3RoQ*UbvA=&s-!cW&RxH(7NtX4(7sBby34
z3(0bQ{DHV^_^{+5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=_zHbrPB0
zbJAN4$#v~1EXLILo)5Hc5>GRm3BeW{P#;W<Sbsg{MBJ&)Rzu@Tucxv4I4>4<7a0vU
zOrf^vnKI*ZG`&fzT(r@*EnSQXg{fUH)2w7tO)RWTpYhOo^KDGCaLE%FiEJm+Z>Xj_
zPGAT9>ov>wM^K5C{rCMi01xYqNMtaoMM<t^hUplU_>7&%v4zvDxs2W<Q}7zgXtimU
zwPm_J;$V!?$+S<4zbD`415RNEIlgS!{xPbTR_>VLjz)GTg=iZh!A>6AnLnB=*PTR*
z@q7!m0UA%(uc)P<5EUQ?M5Dfkr&-6<U87tVILuW7$0BSfxmV;X!x_nHqEAU;tF~3=
z?nJ{dN4QaMShmZzz>muDB6&@4NP~BBWntw1pMZb-D12!0|CdUC^8$SON#G6OMSy&L
z3)lmE4`2Qia15vc3xIFn!=DA-295#^zykIFf54Bw0K5qt2JQm>h9Cbc&;mT*V_+AM
z2j&95pg#uy>en9Xn@WlS#eiZ!F`yVw3@8Q^16Mf%;b}cSh`0M!{kXw^13k;z3h7mc
z;UfyNgt1Z?GG|d|+I;vZD_Nbwit<*4q+RwcMg{-h>L#O-v%brq_~ML0Mbpuq_INak
z<fX4u()2|X5sUDKW!NK(UvY|j_|d>P<`J?7e>c2N@WX)NLl|eov#-6Vi77sB^ga|w
z>bO$c5f#I|tk`Vwo+%L^_9t61`q1tyN8^!xuWmZHAKSZfAO4~|j+Dxea%Au_s1<vh
z)9IRorJ~_!-FCc9qB_vCykGQHJ4+L#xECX_l!ER<i`|qRk7xS0#Y`s!Io$0x1Xsis
p5$or;93>ZfukT^+#hZQm0^Ri1|0Q2J1`H-cJMF6~m6@r^{{z;meR}`^

diff --git a/Course_1/Telegram_Bot/.db_BASE_1182.py.swp b/Course_1/Telegram_Bot/.db_BASE_1182.py.swp
deleted file mode 100644
index 881f5e26945a1952b9edaf636116af4e4548d2df..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 16384
zcmeHOON<mn7%o5*1=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i
zJDfL~6xZxni_sMHcLo|y(66v1zYrB5ha^dT4^FqXqd9t^B5=4X`i@4>P<;Ey6o(U%
z)mWe6#Fi|x!kzJ|Zj5lfQZ+4yuZLfi<~j1B7?bbhV#CP)KM5cC3HZ?D|1XgK|JU&8
zPXI@OR{`?%O<)Ib5x)Fs;0>S*%msdg4?h7M2Mz&Mzyx*xSK!Bg4IBdw0uKUz!I!@T
z)BzXx0@wy*fa$=m=+AzD`n7}lrjlYnF`yVw3@8Q^1BwB~z<->9;Itkc#9Lji0o-W7
zr@qeH3+ZSF5haSd1hG>YLT6!TTHN|DD_)(#jPjO+q+Ro^MiKwN)rm(bulsI;;*C>^
z9!*AjqsNn^*k0rHN+W$CMZ_W;WElwwLRy@HAzpki3WEgf!QTz87re+|@DRiu@$6|Y
zY@*5M4c`X>NgX#zJEEvN*A%Ob-#f(u#@=L$2P9gZ<#0UG@6`+&_hmbm?80A|$B`QH
z!yFmU^lL>P=VZDjVGYsoM%}i(U7|YBv%GKgRC}E!N}(`DVk!CEhZZ|2I~vdAaf_)=
y3UatxZwzjTEh6^Maal?(_D;{k-ibH6cKN#LuK%mPg7g`Thjv<5RVp)8mH!I~?u8=&

diff --git a/Course_1/Telegram_Bot/.db_LOCAL_1182.py.swp b/Course_1/Telegram_Bot/.db_LOCAL_1182.py.swp
deleted file mode 100644
index 78085dc0f3354fd236f21ac4008e90ca09fc5fde..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 16384
zcmeI3+m9R79mh{XDQQUxYE@Bqpr--Jc5u8&P^Boaki9rz#U_ig-hdP(?$|!w3~SGr
znQ?ZPa%n@=i&|9`jo^j054`jNq<|7`AyBER)R(ri?O)K#L)%nUQB|og1-`#IXXYHQ
z?R7|^3Z!$iAK5eK{{5ZHoZonByN=Er;(JSb7{bkr{p-Tc+6!B^vcG(av2G{=x;-jP
zm**d>%ssTTJbh?#=Ft4m<WEt7V+SV2ru=RYit6sMifD<&z-d<}{b;OFtIp0%P0Ut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XqYP){n;h
zhoEUVka5Z#<S#ZnHmTP*@%E$_sXGbR>gb#1AWul@&{TeHmNlmDpq)jT+3^r;US9F5
zh6euQG%{U>SN+1_vi&(5$=-Vg$xE-V+2LOKGKok<99flbB6Tuxa!({KJMEZA3zJTr
z#OJ@E^|C6~okFwwX@O+iYh@kLaHA`7pqej(3@>gn*i08e|M4~Jk2;AuUWk`i$95gZ
zUlzv^dg8Mf<zbY$^cip?TT@{@F6&;~4t(W9d0=PtdM7dMRZdZIPBAK$f^0slILz3(
zKO1`zE_YDS5xC!te@*5hT!b8NFzL{HEIIQY!=2;DrENyr|0BN_lnR>8mi|?h(p;U%
RQ(-ZE>2+N)b+5$;_z<~Gf$jhR

diff --git a/Course_1/Telegram_Bot/.db_REMOTE_1182.py.swp b/Course_1/Telegram_Bot/.db_REMOTE_1182.py.swp
deleted file mode 100644
index c2b78756a0f9ff82641da4c77564dbfb0d4cdf4e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 16384
zcmeHOO^h5z6)r*?4A_8(k_(s0<}f{GJpKuaB1cQu^|s@cy|%ME4nM|>dS+^N8_#qP
z-96r2q3~mKFa!q<h`<Gi5+HCg!45&O6LUi1l3oer5QIpg2nh~=CE!F5-|MRG>iOTS
za{yGO{XEn4|GxL?RlVwQZSTYL3;e$Feune`#%?^nyY~GZJJ=hyGS&@6K-rVhoV|3U
za{R<@dv0NNeqm{3^)FC|dk)R)Ip}wTP*nHrsfd<X4xDy%){piyYSl%1;dsTa?%Q|Y
z{&Hu1WJjjJFkl$i0s}kQJ^T0VrG|G;-NkSJ;K?oYVVW2Q3<HJ%!+>GHFkl!k3>XFs
z1OKZGM4emM7cu!;lmL$Ud`I8sJJs`)`mFVpt4H%;7%&VN1`Gp+0mFb{z%XDKFbo(5
z3<HJ%!@z$b15SgncVk{Zp@1Ln|I_&Y#`_uj8?XVyz)Qeo;BnyFz*m3{a0J)}JpDe#
z9s|~ZRp2b}8Q?T93s}ILJJBETO`s0g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#9_znmX&b5%1OQCf+e7s=di2N_S<M6mt5|;wWWndB)#$Y}P0!NFRJl
t@V2Z)-1l?5Af>SUR1%e+LeA;aQa6JaEExytuH-Ghb|iID(iCa0`X3=oa2@~v

diff --git a/Course_1/Telegram_Bot/db.py.orig b/Course_1/Telegram_Bot/db.py.orig
deleted file mode 100644
index 6bbd96c..0000000
--- a/Course_1/Telegram_Bot/db.py.orig
+++ /dev/null
@@ -1,131 +0,0 @@
-import sqlite3
-
-from typing import List, Tuple
-
-
-class Connections(object):
-    database = 'Homework.db'
-
-    @staticmethod
-    def safe(func):
-        def inside(*args, **kwargs):
-            with sqlite3.connect(Connections.database) as connection:
-                result = func(*args, connection=(connection, connection.cursor()), **kwargs)
-            return result
-        return inside
-
-
-class Database(object):
-
-    class UsersDB(object):
-        @Connections.safe
-        def init(self, connection: tuple):
-            connection, cursor = connection
-            cursor.execute('''create table if not exists Users (
-            id          INTEGER primary key,
-            chat_id     TEXT,
-            user_group  TEXT
-            )''')
-            connection.commit()
-
-        @Connections.safe
-        def add_user(self, connection: tuple, chat_id: str, user_group: str):
-            connection, cursor = connection
-            try:
-                cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''',
-                               (chat_id, user_group.upper()))
-            except sqlite3.IntegrityError:
-                cursor.execute('''UPDATE Users SET user_group = ? WHERE chat_id = ?;''', (user_group, chat_id))
-            finally:
-                connection.commit()
-
-        @Connections.safe
-        def get_user_group(self, connection: tuple, chat_id: str) -> str:
-            connection, cursor = connection
-            cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
-            connection.commit()
-            return cursor
-
-    @Connections.safe
-    def init(self, connection: tuple, name: str = 'Homework') -> None:
-        connection, cursor = connection
-        cursor.execute(
-            f'create table if not exists {name}('
-            f'id         INTEGER primary key,'
-            f'subject_id int  not null,'
-            f'date       text not null,'
-            f'text       text not null,'
-            f'"Group"      text not null,'
-            f'Author     text not null)'
-        )
-
-        connection.commit()
-
-    @Connections.safe
-    def add_homework(self, connection: tuple, subject_name: str,
-                     text: str, date: str, username: str, group: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        subject_name = subject_name.lower()
-        if is_added:
-            return 'Запись уже присутствует'
-        connection, cursor = connection
-        # Записываем
-        cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
-                       (subject_name, date, text, group, username))
-        connection.commit()
-        return 'Домашнее задание добавлено'
-
-    @Connections.safe
-    def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
-        connection, cursor = connection
-        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
-                                (date, group)).fetchall()
-        connection.commit()
-        if data:
-            return cursor
-
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor = cursor.execute(
-            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
-        subject_name = subject_name.lower()
-        connection, cursor = connection
-        answer = cursor.execute(
-            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if not answer:
-            return answer
-        return answer[0][0]
-
-    @Connections.safe
-    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute(
-            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
-            (text, subject_name, date, group)
-        )
-        connection.commit()
-
-    @Connections.safe
-    def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute('''
-        DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
-        connection.commit()
\ No newline at end of file
diff --git a/Course_1/Telegram_Bot/db_BASE_1182.py b/Course_1/Telegram_Bot/db_BASE_1182.py
deleted file mode 100644
index 72f1ac6..0000000
--- a/Course_1/Telegram_Bot/db_BASE_1182.py
+++ /dev/null
@@ -1,131 +0,0 @@
-import sqlite3
-
-from typing import List, Tuple
-
-
-class Connections(object):
-    database = 'Homework.db'
-
-    @staticmethod
-    def safe(func):
-        def inside(*args, **kwargs):
-            with sqlite3.connect(Connections.database) as connection:
-                result = func(*args, connection=(connection, connection.cursor()), **kwargs)
-            return result
-        return inside
-
-
-class Database(object):
-
-    class UsersDB(object):
-        @Connections.safe
-        def init(self, connection: tuple):
-            connection, cursor = connection
-            cursor.execute('''create table if not exists Users (
-            id          INTEGER primary key,
-            chat_id     TEXT not null,
-            user_group  TEXT not null 
-            )''')
-            connection.commit()
-
-        @Connections.safe
-        def add_user(self, connection: tuple, chat_id: str, user_group: str):
-            connection, cursor = connection
-            try:
-                cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''',
-                               (chat_id, user_group.upper()))
-            except sqlite3.IntegrityError:
-                cursor.execute('''UPDATE Users SET user_group = ? WHERE chat_id = ?;''', (user_group, chat_id))
-            finally:
-                connection.commit()
-
-        @Connections.safe
-        def get_user_group(self, connection: tuple, chat_id: str) -> str:
-            connection, cursor = connection
-            cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
-            connection.commit()
-            return cursor
-
-    @Connections.safe
-    def init(self, connection: tuple, name: str = 'Homework') -> None:
-        connection, cursor = connection
-        cursor.execute(
-            f'create table if not exists {name}('
-            f'id         INTEGER primary key,'
-            f'subject_id int  not null,'
-            f'date       text not null,'
-            f'text       text not null'
-            f'"Group"    text not null,'
-            f'Author     text not null)'
-        )
-
-        connection.commit()
-
-    @Connections.safe
-    def add_homework(self, connection: tuple, subject_name: str,
-                     text: str, date: str, username: str, group: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        subject_name = subject_name.lower()
-        if is_added:
-            return 'Запись уже присутствует'
-        connection, cursor = connection
-        # Записываем
-        cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
-                       (subject_name, date, text, group, username))
-        connection.commit()
-        return 'Домашнее задание добавлено'
-
-    @Connections.safe
-    def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
-        connection, cursor = connection
-        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
-                                (date, group)).fetchall()
-        connection.commit()
-        if data:
-            return cursor
-
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor = cursor.execute(
-            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
-        subject_name = subject_name.lower()
-        connection, cursor = connection
-        answer = cursor.execute(
-            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if not answer:
-            return answer
-        return answer[0][0]
-
-    @Connections.safe
-    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute(
-            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
-            (text, subject_name, date, group)
-        )
-        connection.commit()
-
-    @Connections.safe
-    def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute('''
-        DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
-        connection.commit()
diff --git a/Course_1/Telegram_Bot/db_LOCAL_1182.py b/Course_1/Telegram_Bot/db_LOCAL_1182.py
deleted file mode 100644
index 9fe1e8d..0000000
--- a/Course_1/Telegram_Bot/db_LOCAL_1182.py
+++ /dev/null
@@ -1,131 +0,0 @@
-import sqlite3
-
-from typing import List, Tuple
-
-
-class Connections(object):
-    database = 'Homework.db'
-
-    @staticmethod
-    def safe(func):
-        def inside(*args, **kwargs):
-            with sqlite3.connect(Connections.database) as connection:
-                result = func(*args, connection=(connection, connection.cursor()), **kwargs)
-            return result
-        return inside
-
-
-class Database(object):
-
-    class UsersDB(object):
-        @Connections.safe
-        def init(self, connection: tuple):
-            connection, cursor = connection
-            cursor.execute('''create table if not exists Users (
-            id          INTEGER primary key,
-            chat_id     TEXT not null,
-            user_group  TEXT not null 
-            )''')
-            connection.commit()
-
-        @Connections.safe
-        def add_user(self, connection: tuple, chat_id: str, user_group: str):
-            connection, cursor = connection
-            try:
-                cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''',
-                               (chat_id, user_group.upper()))
-            except sqlite3.IntegrityError:
-                cursor.execute('''UPDATE Users SET user_group = ? WHERE chat_id = ?;''', (user_group, chat_id))
-            finally:
-                connection.commit()
-
-        @Connections.safe
-        def get_user_group(self, connection: tuple, chat_id: str) -> str:
-            connection, cursor = connection
-            cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
-            connection.commit()
-            return cursor
-
-    @Connections.safe
-    def init(self, connection: tuple, name: str = 'Homework') -> None:
-        connection, cursor = connection
-        cursor.execute(
-            f'create table if not exists {name}('
-            f'id         INTEGER primary key,'
-            f'subject_id int  not null,'
-            f'date       text not null,'
-            f'text       text not null,'
-            f'"Group"      text not null,'
-            f'Author     text not null)'
-        )
-
-        connection.commit()
-
-    @Connections.safe
-    def add_homework(self, connection: tuple, subject_name: str,
-                     text: str, date: str, username: str, group: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        subject_name = subject_name.lower()
-        if is_added:
-            return 'Запись уже присутствует'
-        connection, cursor = connection
-        # Записываем
-        cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
-                       (subject_name, date, text, group, username))
-        connection.commit()
-        return 'Домашнее задание добавлено'
-
-    @Connections.safe
-    def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
-        connection, cursor = connection
-        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
-                                (date, group)).fetchall()
-        connection.commit()
-        if data:
-            return cursor
-
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor = cursor.execute(
-            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
-        subject_name = subject_name.lower()
-        connection, cursor = connection
-        answer = cursor.execute(
-            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if not answer:
-            return answer
-        return answer[0][0]
-
-    @Connections.safe
-    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute(
-            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
-            (text, subject_name, date, group)
-        )
-        connection.commit()
-
-    @Connections.safe
-    def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute('''
-        DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
-        connection.commit()
\ No newline at end of file
diff --git a/Course_1/Telegram_Bot/db_REMOTE_1182.py b/Course_1/Telegram_Bot/db_REMOTE_1182.py
deleted file mode 100644
index 346105b..0000000
--- a/Course_1/Telegram_Bot/db_REMOTE_1182.py
+++ /dev/null
@@ -1,131 +0,0 @@
-import sqlite3
-
-from typing import List, Tuple
-
-
-class Connections(object):
-    database = 'Homework.db'
-
-    @staticmethod
-    def safe(func):
-        def inside(*args, **kwargs):
-            with sqlite3.connect(Connections.database) as connection:
-                result = func(*args, connection=(connection, connection.cursor()), **kwargs)
-            return result
-        return inside
-
-
-class Database(object):
-
-    class UsersDB(object):
-        @Connections.safe
-        def init(self, connection: tuple):
-            connection, cursor = connection
-            cursor.execute('''create table if not exists Users (
-            id          INTEGER primary key,
-            chat_id     TEXT,
-            user_group  TEXT
-            )''')
-            connection.commit()
-
-        @Connections.safe
-        def add_user(self, connection: tuple, chat_id: str, user_group: str):
-            connection, cursor = connection
-            try:
-                cursor.execute('''INSERT INTO Users (chat_id, user_group) VALUES (?, ?)''',
-                               (chat_id, user_group.upper()))
-            except sqlite3.IntegrityError:
-                cursor.execute('''UPDATE Users SET user_group = ? WHERE chat_id = ?;''', (user_group, chat_id))
-            finally:
-                connection.commit()
-
-        @Connections.safe
-        def get_user_group(self, connection: tuple, chat_id: str) -> str:
-            connection, cursor = connection
-            cursor = cursor.execute('''SELECT user_group FROM Users WHERE chat_id = ?''', (chat_id,)).fetchall()
-            connection.commit()
-            return cursor
-
-    @Connections.safe
-    def init(self, connection: tuple, name: str = 'Homework') -> None:
-        connection, cursor = connection
-        cursor.execute(
-            f'create table if not exists {name}('
-            f'id         INTEGER primary key,'
-            f'subject_id int,'
-            f'date       text,'
-            f'text       text,'
-            f'"Group"    text,'
-            f'Author     text)'
-        )
-
-        connection.commit()
-
-    @Connections.safe
-    def add_homework(self, connection: tuple, subject_name: str,
-                     text: str, date: str, username: str, group: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        subject_name = subject_name.lower()
-        if is_added:
-            return 'Запись уже присутствует'
-        connection, cursor = connection
-        # Записываем
-        cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
-                       (subject_name, date, text, group, username))
-        connection.commit()
-        return 'Домашнее задание добавлено'
-
-    @Connections.safe
-    def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):
-        connection, cursor = connection
-        cursor = cursor.execute('''SELECT subject_id, text FROM Homework WHERE date = ? and "Group" = ?''',
-                                (date, group)).fetchall()
-        connection.commit()
-        if data:
-            return cursor
-
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def is_exists(self, connection: tuple, subject_name: str, date: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor = cursor.execute(
-            '''SELECT subject_id and date FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if cursor:
-            return True
-        return False
-
-    @Connections.safe
-    def receive_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> str or List[Tuple[str]]:
-        subject_name = subject_name.lower()
-        connection, cursor = connection
-        answer = cursor.execute(
-            '''SELECT text FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?''',
-            (subject_name, date, group)).fetchall()
-        connection.commit()
-        if not answer:
-            return answer
-        return answer[0][0]
-
-    @Connections.safe
-    def edit_homework(self, connection: tuple, subject_name: str, date: str, text: str, group: str):
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute(
-            '''UPDATE Homework SET text = ? WHERE subject_id = ? and date = ? and "Group" = ?;''',
-            (text, subject_name, date, group)
-        )
-        connection.commit()
-
-    @Connections.safe
-    def delete_homework(self, connection: tuple, subject_name: str, date: str, group: str) -> None:
-        connection, cursor = connection
-        subject_name = subject_name.lower()
-        cursor.execute('''
-        DELETE FROM Homework WHERE subject_id = ? and date = ? and "Group" = ?;''', (subject_name, date, group))
-        connection.commit()

From 14018e775d680e445000e5e157d6309e614b4917 Mon Sep 17 00:00:00 2001
From: GinKey <monotank23@gmail.com>
Date: Sun, 13 Mar 2022 14:32:53 +0300
Subject: [PATCH 14/15] edit update #13

---
 Course_1/Telegram_Bot/bot.py | 99 ++++++++++++++++++++++++++++--------
 Course_1/Telegram_Bot/db.py  |  7 +--
 2 files changed, 80 insertions(+), 26 deletions(-)

diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index 975cccb..cd075e3 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -96,6 +96,37 @@ async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
 		print(e)
 
 
+@dp.callback_query_handler(lambda query: 'Inline' not in query.data, state=SelfState.Edit_state)
+async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
+	try:
+		async with state.proxy() as data:
+			data['subject'] = query.conf
+			date_count = data['date_count']
+			data["state"] = True
+
+		schedule = get_group_schedule(group=get_user_group(query.message), start=week_definition(date_count, debug=True))
+		transliterated_schedule = list(map(
+			lambda x: tr.translit(x, language_code='ru', reversed=True), schedule))
+		subject = None
+		for pos, let in enumerate(transliterated_schedule):
+			if query.data == let:
+				subject = schedule[pos]
+		if subject is None:
+			async with state.proxy() as data:
+				subject = data['subject']
+
+		async with state.proxy() as data:
+			data['subject'] = subject
+		start_date, end_date = week_definition(date_count)
+		await bot.edit_message_text(
+			chat_id=query.message.chat.id,
+			message_id=query.message.message_id,
+			text=f'*Введите новое задание*',
+			parse_mode='markdown')
+	except KeyError as e:
+		print(e)		
+
+
 @dp.message_handler(commands=['start'], state="*")
 async def process_start_command(message: types.Message):
 	await message.answer("Привет! Для получения задания, скажи из какой ты группы!\n\nНапример: ПИ21-7")
@@ -174,39 +205,33 @@ async def add_homework(message: types.Message, state: FSMContext):
 
 
 @dp.callback_query_handler(text='Inline_Edit')
-async def edit_init(call: types.CallbackQuery):
-	await SelfState.Edit_state.set()
+async def edit_init(call: types.CallbackQuery, state: FSMContext):
+	async with state.proxy() as data:
+		data['state'] = True
+		date_count = data['date_count']
+	start_date, end_date = week_definition(date_count)
 	await bot.edit_message_text(
 		chat_id=call.message.chat.id,
 		message_id=call.message.message_id,
-		text=f"*Введите предмет и дату для редактирования:\n\nПример:* `Алгебра 15.03.2022`",
-		parse_mode="markdown",
+		text=f"*На какой день задание?\n📅 {start_date} - {end_date} 📅*",
+		reply_markup = Buttons.Inline_Date_ADD,
+		parse_mode = "markdown"
 	)
+	await SelfState.Edit_state.set()
 
 
 @dp.message_handler(state=SelfState.Edit_state)
 async def edit_homework(message: types.Message, state: FSMContext):
-	text = message.text.split()
-	if len(text) < 2 or all(map(lambda x: len(x) > 3, text)):
-		await message.answer_sticker(sticker='CAACAgIAAxkBAAEEG9BiKojK_SZBFl_KqTqswln3CM1ptQAC7xMAApJeSUuQKkME9nIP_SME')
-		await state.finish()
-		return 0
-	Subject, Date = text[0], text[1]
+	text = message.text
+	async with state.proxy() as data:
+		Date = data['date']
+		Subject = data['subject']
+	print(Date, Subject, get_user_group(message))
 	if HDB.is_exists(date=Date, subject_name=Subject, group=get_user_group(message)):
 		print(message.from_user.username, 'отредактировал:\n', text)
-		await bot.edit_message_text(
-			chat_id=message.chat.id,
-			message_id=message.message_id - 1,
-			text=f"*Введите данные для изменения:\n\nПример:* `Алгебра 15.03.2022 Подготовиться к кр`",
-			parse_mode="markdown",
-		)
-		await bot.delete_message(
-			chat_id=message.chat.id,
-			message_id=message.message_id
-		)
 		HDB.delete_homework(subject_name=Subject, date=Date, group=get_user_group(message))
+		await message.answer(text=f'*{HDB.add_homework(subject_name=Subject,username=message.from_user.username,text=text, date=Date, group=get_user_group(message), edit = True)}*', parse_mode='markdown')
 		await state.finish()
-		await SelfState.Add_state.set()
 	else:
 		await message.answer(text='*Такой записи не существует!*', parse_mode='markdown')
 		await state.finish()
@@ -239,6 +264,38 @@ async def add_homework_date(query: types.CallbackQuery, state: FSMContext):
 		await SelfState.Add_state.set()
 
 
+@dp.callback_query_handler(lambda query: query.data.split('_')[2][0] == 'B', state=SelfState.Edit_state)
+async def add_homework_date(query: types.CallbackQuery, state: FSMContext):
+	async with state.proxy() as data:
+		current_state = data['state']
+		date_count = data['date_count']
+	if current_state:
+		day = query.data.split("_")[2]
+		days = {
+			'Bm': 0,
+			'Bt': 1,
+			'Bwd': 2,
+			'Bth': 3,
+			'Bf': 4,
+			'BSn': 5
+		}
+		start_date = week_definition(date_count, debug=True)
+		async with state.proxy() as data:
+			data['date'] = (start_date + timedelta(days=days[day])).strftime('%d.%m.%Y')
+			Date = data["date"]
+		homework = HDB.is_available_homework_by_date(date=Date, group=get_user_group(query.message), data=True)
+		homework = list(map(lambda x: x[0], homework))
+		print(homework)
+		await bot.edit_message_text(
+			text='*Выберите предмет*',
+			chat_id=query.message.chat.id,
+			message_id=query.message.message_id,
+			parse_mode='markdown',
+			reply_markup=Buttons.create_subjects_keyboard(homework) 
+		)
+		await SelfState.Edit_state.set()
+
+
 @dp.callback_query_handler(lambda query: query.data.split('_')[2][0] == 'B')
 async def homework_reply(query: types.CallbackQuery, state: FSMContext):
 	day = query.data.split("_")[2]
diff --git a/Course_1/Telegram_Bot/db.py b/Course_1/Telegram_Bot/db.py
index 196be1b..5e6f363 100644
--- a/Course_1/Telegram_Bot/db.py
+++ b/Course_1/Telegram_Bot/db.py
@@ -63,16 +63,13 @@ def init(self, connection: tuple, name: str = 'Homework') -> None:
 
     @Connections.safe
     def add_homework(self, connection: tuple, subject_name: str,
-                     text: str, date: str, username: str, group: str) -> str:
-        is_added = self.receive_homework(subject_name=subject_name, date=date, group=group)
-        if is_added:
-            return 'Запись уже присутствует'
+                     text: str, date: str, username: str, group: str, edit: bool=False) -> str:
         connection, cursor = connection
         # Записываем
         cursor.execute('''INSERT INTO Homework (subject_id, date, text, "Group", Author) VALUES (?, ?, ?, ?, ?)''',
                        (subject_name, date, text, group, username))
         connection.commit()
-        return 'Домашнее задание добавлено'
+        return 'Домашнее задание добавлено' if not edit else "Домашнее задание изменено"
 
     @Connections.safe
     def is_available_homework_by_date(self, connection: tuple, date: str, group: str, data=False):

From e603396e6cf55ca5247696444ca567a1850fd92d Mon Sep 17 00:00:00 2001
From: Nikolai <ya.pikus@gmail.com>
Date: Sun, 13 Mar 2022 14:37:42 +0300
Subject: [PATCH 15/15] RELEASE v2.0! #13

---
 Course_1/Telegram_Bot/bot.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Course_1/Telegram_Bot/bot.py b/Course_1/Telegram_Bot/bot.py
index cd075e3..84e2d52 100644
--- a/Course_1/Telegram_Bot/bot.py
+++ b/Course_1/Telegram_Bot/bot.py
@@ -117,14 +117,13 @@ async def add_homework_subject(query: types.CallbackQuery, state: FSMContext):
 
 		async with state.proxy() as data:
 			data['subject'] = subject
-		start_date, end_date = week_definition(date_count)
 		await bot.edit_message_text(
 			chat_id=query.message.chat.id,
 			message_id=query.message.message_id,
 			text=f'*Введите новое задание*',
 			parse_mode='markdown')
 	except KeyError as e:
-		print(e)		
+		print(e)
 
 
 @dp.message_handler(commands=['start'], state="*")
@@ -214,8 +213,8 @@ async def edit_init(call: types.CallbackQuery, state: FSMContext):
 		chat_id=call.message.chat.id,
 		message_id=call.message.message_id,
 		text=f"*На какой день задание?\n📅 {start_date} - {end_date} 📅*",
-		reply_markup = Buttons.Inline_Date_ADD,
-		parse_mode = "markdown"
+		reply_markup=Buttons.Inline_Date_ADD,
+		parse_mode="markdown"
 	)
 	await SelfState.Edit_state.set()
 
@@ -230,7 +229,8 @@ async def edit_homework(message: types.Message, state: FSMContext):
 	if HDB.is_exists(date=Date, subject_name=Subject, group=get_user_group(message)):
 		print(message.from_user.username, 'отредактировал:\n', text)
 		HDB.delete_homework(subject_name=Subject, date=Date, group=get_user_group(message))
-		await message.answer(text=f'*{HDB.add_homework(subject_name=Subject,username=message.from_user.username,text=text, date=Date, group=get_user_group(message), edit = True)}*', parse_mode='markdown')
+		await message.answer(
+			text=f'*{HDB.add_homework(subject_name=Subject,username=message.from_user.username,text=text, date=Date, group=get_user_group(message), edit = True)}*', parse_mode='markdown')
 		await state.finish()
 	else:
 		await message.answer(text='*Такой записи не существует!*', parse_mode='markdown')
@@ -291,7 +291,7 @@ async def add_homework_date(query: types.CallbackQuery, state: FSMContext):
 			chat_id=query.message.chat.id,
 			message_id=query.message.message_id,
 			parse_mode='markdown',
-			reply_markup=Buttons.create_subjects_keyboard(homework) 
+			reply_markup=Buttons.create_subjects_keyboard(homework)
 		)
 		await SelfState.Edit_state.set()