Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MothScientist committed Apr 4, 2024
1 parent cef6ee7 commit a17e124
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ def get_csv(message) -> None:
connection = connect_db()
bot_db = DatabaseQueries(connection)
group_id: int = bot_db.get_group_id_by_telegram_id(telegram_id)
file_path: str = f"csv_tables/table_{group_id}.csv"
file_path: str = path.join(path.dirname(__file__), f"csv_tables/table_{group_id}.csv")
table_headers: tuple = ("ID", "USERNAME", "TRANSFER", "TOTAL", "DATE", "CATEGORY", "DESCRIPTION")
table_data: tuple = bot_db.select_data_for_household_table(group_id, 0)
table_data: tuple[tuple, ...] = bot_db.select_data_for_household_table(group_id, 0)
close_db(connection)
if table_data:
try:
Expand Down Expand Up @@ -699,7 +699,7 @@ def process_delete_account(message, username: str):
if user_choice == f"👍 {get_phrase_by_language(user_language, "YES")}":
connection = connect_db()
bot_db = DatabaseQueries(connection)
bot_db.delete_username_from_users(username)
bot_db.delete_username_from_users_by_telegram_id(telegram_id)
close_db(connection)
bot.send_message(message.chat.id, f"{get_phrase_by_language(user_language, "parting")}")
bot.send_message(message.chat.id, f"{get_phrase_by_language(user_language, "account_is_deleted")}",
Expand Down
2 changes: 2 additions & 0 deletions app/build_project.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
sys.path.append('../')
from app.db_manager import connect_db, close_db # noqa
Expand All @@ -7,6 +8,7 @@ def create_db() -> None:
"""
Creates tables, using create_db.sql file describing their structures.
"""
os.makedirs('csv_tables', exist_ok=True)
conn = connect_db()
try:
with conn.cursor() as cur:
Expand Down
2 changes: 1 addition & 1 deletion app/create_db.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS groups (
id serial PRIMARY KEY,
owner bigint NOT NULL UNIQUE CHECK(telegram_id BETWEEN 1 AND 999999999999),
owner bigint NOT NULL UNIQUE CHECK(owner BETWEEN 1 AND 999999999999),
token varchar(32) NOT NULL UNIQUE CHECK(LENGTH(token) = 32)
);

Expand Down
2 changes: 1 addition & 1 deletion app/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def getting_hash(secure_key: str, salt: str,
:param salt: get_salt()
:return: hash in hex format
"""
return pbkdf2_hmac(hash_algorithm, secure_key.encode('utf-8'), salt.encode('utf-8'), iterations, key_length).hex()
return pbkdf2_hmac(hash_algorithm, secure_key.encode('utf-8'), salt.encode('utf-8'), iterations, key_length).hex()
File renamed without changes.

0 comments on commit a17e124

Please sign in to comment.