+----+---------+------------+--------+--------------+------------+
| id | message | date | status | from_user_id | to_user_id |
+----+---------+------------+--------+--------------+------------+
| 1 | ... | 1693310921 | 0 | 15 | 20 |
| 2 | ... | 1693317654 | 0 | 20 | 15 |
| 3 | ... | 1693318102 | 0 | 19 | 15 |
| 4 | ... | 1693318124 | 0 | 15 | 19 |
+----+---------+------------+--------+--------------+------------+
+----+---------+
| id | login |
+----+---------+
| 15 | user1 |
| 19 | user2 |
| 20 | user3 |
+----+---------+
SELECT
m1.*,
u1.login AS from_user_login,
u2.login AS to_user_login
FROM
messages m1
JOIN
(
SELECT
LEAST(from_user_id, to_user_id) AS user1_id,
GREATEST(from_user_id, to_user_id) AS user2_id,
MAX(date) AS max_date
FROM
messages
GROUP BY
LEAST(from_user_id, to_user_id),
GREATEST(from_user_id, to_user_id)
) m2 ON LEAST(m1.from_user_id, m1.to_user_id) = m2.user1_id
AND GREATEST(m1.from_user_id, m1.to_user_id) = m2.user2_id
AND m1.date = m2.max_date
JOIN
users u1 ON m1.from_user_id = u1.id
JOIN
users u2 ON m1.to_user_id = u2.id;
removeStyleTags() {
const elements = document.querySelectorAll('.компонент'); // Замените на ваш класс компонента
elements.forEach(element => {
const styleTags = element.querySelectorAll('style');
styleTags.forEach(tag => {
tag.parentNode.removeChild(tag);
});
});
}
services:
db:
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_general_ci
environment:
MYSQL_ROOT_PASSWORD: yourpassword
ports:
- "3306:3306"
@dp.message_handler(state=NewOrder.name)
async def add_item_name(message: types.Message, state: FSMContext):
async with state.proxy() as data:
data['name'] = message.text
data['desc'] = "" # Установите начальное значение для ключа 'desc'
await message.answer(f'Опиши индивидуальный проект:')
print(f"Data after adding name: {data}")
await NewOrder.desc.set()
define( 'CUSTOM_USER_TABLE', $shared_table_prefix . 'my_users' );
define( 'CUSTOM_USER_META_TABLE', $shared_table_prefix . 'my_usermeta' );
def saveState(self):
settings = QSettings('gui.ini', QSettings.Format.IniFormat)
for type, method in self._get_saving_types():
for widget in self.findChildren(type):
if isinstance(widget, QListWidget):
items = []
for index in range(widget.count()):
items.append(widget.item(index).text()) # Сохраняем текст элемента
settings.setValue(widget.objectName(), items)
else:
settings.setValue(widget.objectName(), methodcaller(method[1])(widget))
def loadState(self):
settings = QSettings('gui.ini', QSettings.Format.IniFormat)
for type, method in self._get_saving_types():
for widget in self.findChildren(type):
if settings.contains(widget.objectName()):
if isinstance(widget, QListWidget):
items = settings.value(widget.objectName(), [])
widget.clear()
widget.addItems(items)
else:
methodcaller(method[0], settings.value(widget.objectName()))(widget)