2022-11-30 21:10:20 +00:00
|
|
|
from sqlalchemy import inspect
|
|
|
|
|
2022-12-11 23:44:34 +00:00
|
|
|
from files.helpers.config.awards import AWARDS_ENABLED, AWARDS_DISABLED
|
2022-11-30 21:10:20 +00:00
|
|
|
from files.__main__ import engine
|
|
|
|
|
|
|
|
from files.events.classes import *
|
|
|
|
from files.events.helpers import *
|
|
|
|
from files.events.routes import *
|
|
|
|
|
|
|
|
def _build_table():
|
|
|
|
if not inspect(engine).has_table(EventUser.__table__.name, schema="public"):
|
|
|
|
print("[EVENT] Building event table...")
|
|
|
|
EventUser.__table__.create(bind=engine, checkfirst=True)
|
|
|
|
|
|
|
|
def _populate_awards():
|
2022-12-11 23:44:34 +00:00
|
|
|
temp = {x: AWARDS_ENABLED[x] for x in AWARDS_ENABLED if x not in EVENT_AWARDS}
|
|
|
|
AWARDS_ENABLED.clear()
|
|
|
|
AWARDS_ENABLED.update(EVENT_AWARDS)
|
|
|
|
AWARDS_ENABLED.update(temp)
|
2022-11-30 21:10:20 +00:00
|
|
|
|
|
|
|
for award in EVENT_AWARDS:
|
|
|
|
if award in AWARDS_DISABLED:
|
|
|
|
AWARDS_DISABLED.remove(award)
|
|
|
|
|
|
|
|
def event_init():
|
|
|
|
_build_table()
|
|
|
|
|
|
|
|
_populate_awards()
|