Archived
add sort
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
FROM python:3.9-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y cron
|
||||
# RUN apt-get install -y cron
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -56,14 +56,6 @@ def into_list(rows: list[tuple], column_name: list[tuple]) -> list[dict]:
|
||||
|
||||
|
||||
def save_user(infos):
|
||||
# infos = [
|
||||
# call.from_user.id,
|
||||
# call.from_user.first_name,
|
||||
# call.from_user.last_name,
|
||||
# call.from_user.username,
|
||||
# call.data,
|
||||
# ]
|
||||
|
||||
conn = db.getconn()
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(
|
||||
@@ -179,6 +171,8 @@ def create_schedule_tasks(manual=False):
|
||||
continue
|
||||
schdl = into_list(data, cursor.description)
|
||||
|
||||
schdl.sort(key=lambda lesson: datetime.strptime(lesson["begin_time"], "%H:%M"))
|
||||
|
||||
for lesson in schdl:
|
||||
if not lesson["course"]:
|
||||
continue
|
||||
|
||||
@@ -7,46 +7,8 @@ from psycopg2 import pool
|
||||
import json
|
||||
|
||||
|
||||
allow_update = True
|
||||
|
||||
load_dotenv()
|
||||
|
||||
"""
|
||||
{
|
||||
"1025872648": {
|
||||
"username": "ahunuin",
|
||||
"first_name": "Arseniy",
|
||||
"last_name": "",
|
||||
"group": "205",
|
||||
"timeout": "10",
|
||||
"allow_message": "yes",
|
||||
"thread": "General"
|
||||
},
|
||||
"856850518": {
|
||||
"username": "kr0sh_512",
|
||||
"first_name": "Дмитрий",
|
||||
"last_name": "",
|
||||
"group": "202",
|
||||
"timeout": "10",
|
||||
"allow_message": "no",
|
||||
"thread": "General"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id BIGINT PRIMARY KEY,
|
||||
username VARCHAR(255),
|
||||
first_name VARCHAR(255),
|
||||
last_name VARCHAR(255),
|
||||
"group" VARCHAR(255) DEFAULT 'other',
|
||||
timeout INT DEFAULT 10,
|
||||
allow_message BOOLEAN DEFAULT TRUE,
|
||||
thread VARCHAR(255) DEFAULT 'General',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
"""
|
||||
|
||||
if os.environ.get("ENV") == "dev":
|
||||
print("DEV: Connecting to local database")
|
||||
|
||||
Reference in New Issue
Block a user