removed user_db; added make remove_db
This commit is contained in:
parent
c0fa81c373
commit
20ed95115b
4
Makefile
4
Makefile
|
@ -69,6 +69,10 @@ db:
|
|||
#if not exist generate task.sqlite3 database based on schema
|
||||
sqlite3 database/$(TASK_DB).$(DB_SUFFIX) '.read database/$(TASK_DB).sql'
|
||||
|
||||
reset_db:
|
||||
mv database/$(TASK_DB).$(DB_SUFFIX) database/$(TASK_DB).$(DB_SUFFIX).$(date -u +"%Y-%m-%d")
|
||||
sqlite3 database/$(TASK_DB).$(DB_SUFFIX) '.read database/$(TASK_DB).sql'
|
||||
|
||||
run:
|
||||
#TODO (supervisor)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ PARSED_MESSAGEENTITIES = dict[MessageEntity, str]
|
|||
#paths
|
||||
CONFIG_FILE_PATH = 'app/config.json'
|
||||
TASKS_DB_PATH = 'database/task.sqlite3'
|
||||
USER_DB_PATH = 'database/user.sqlite3'
|
||||
|
||||
#runtime constants
|
||||
ANY_MENTION = [MessageEntity.MENTION, MessageEntity.TEXT_MENTION]
|
||||
|
|
|
@ -9,6 +9,7 @@ from constants import PERIODS, TASKS_DB_PATH
|
|||
|
||||
# db connections
|
||||
task_db: sqlite3.Connection = sqlite3.connect(TASKS_DB_PATH,check_same_thread=False)
|
||||
#user_db: sqlite3.Connection = sqlite3.connect(USER_DB_PATH,check_same_thread=False)
|
||||
|
||||
|
||||
### TASK related queries
|
||||
|
@ -214,4 +215,5 @@ def get_top_contributors( top_n: int, period: Literal['day','week','month','ye
|
|||
;"""
|
||||
query_results = db.execute(query, (top_n,))
|
||||
|
||||
return dict(query_results)
|
||||
return dict(query_results)
|
||||
|
||||
|
|
|
@ -134,16 +134,17 @@ def export_db(update: Update, context: CallbackContext) -> None:
|
|||
update.message.reply_document(document=file_to_send, filename=file_name, quote=True)
|
||||
|
||||
|
||||
|
||||
@command
|
||||
def stats(update: Update, context: CallbackContext) -> None:
|
||||
"""stats about task done in a specific timeframe
|
||||
|
||||
/stats topN [bountyhunters]
|
||||
[[day | today] | yesterday | Ndays | daysN |
|
||||
/stats topN [[day | today] | yesterday | Ndays | daysN |
|
||||
[week | thisweek] | pastweek | Nweeks | weeksN |
|
||||
[month | thismonth] | pastmonth | Nmonths | monthsN |
|
||||
[year | thisyear] | pastyear |
|
||||
[overall | alltimes]]
|
||||
[bountyhunters]
|
||||
topN: get only the N top contributors
|
||||
day: """ #TODO user guide
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
-- db with informations about the telegram user
|
||||
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
username TEXT,
|
||||
firstname TEXT,
|
||||
lastname TEXT,
|
||||
object BLOB
|
||||
);
|
||||
|
||||
COMMIT;
|
Loading…
Reference in New Issue